Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: src/compiler.cc

Issue 928343003: CpuProfile: rename HSourcePosition to SourcePosition and move it to compiler.* (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comments addressed Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler.h ('k') | src/hydrogen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 8
9 #include "src/ast-numbering.h" 9 #include "src/ast-numbering.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 17 matching lines...) Expand all
28 #include "src/scanner-character-streams.h" 28 #include "src/scanner-character-streams.h"
29 #include "src/scopeinfo.h" 29 #include "src/scopeinfo.h"
30 #include "src/scopes.h" 30 #include "src/scopes.h"
31 #include "src/typing.h" 31 #include "src/typing.h"
32 #include "src/vm-state-inl.h" 32 #include "src/vm-state-inl.h"
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 37
38 std::ostream& operator<<(std::ostream& os, const SourcePosition& p) {
39 if (p.IsUnknown()) {
40 return os << "<?>";
41 } else if (FLAG_hydrogen_track_positions) {
42 return os << "<" << p.inlining_id() << ":" << p.position() << ">";
43 } else {
44 return os << "<0:" << p.raw() << ">";
45 }
46 }
47
48
38 ScriptData::ScriptData(const byte* data, int length) 49 ScriptData::ScriptData(const byte* data, int length)
39 : owns_data_(false), rejected_(false), data_(data), length_(length) { 50 : owns_data_(false), rejected_(false), data_(data), length_(length) {
40 if (!IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment)) { 51 if (!IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment)) {
41 byte* copy = NewArray<byte>(length); 52 byte* copy = NewArray<byte>(length);
42 DCHECK(IsAligned(reinterpret_cast<intptr_t>(copy), kPointerAlignment)); 53 DCHECK(IsAligned(reinterpret_cast<intptr_t>(copy), kPointerAlignment));
43 CopyBytes(copy, data, length); 54 CopyBytes(copy, data, length);
44 data_ = copy; 55 data_ = copy;
45 AcquireDataOwnership(); 56 AcquireDataOwnership();
46 } 57 }
47 } 58 }
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 328 }
318 } 329 }
319 330
320 331
321 bool CompilationInfo::is_simple_parameter_list() { 332 bool CompilationInfo::is_simple_parameter_list() {
322 return scope_->is_simple_parameter_list(); 333 return scope_->is_simple_parameter_list();
323 } 334 }
324 335
325 336
326 int CompilationInfo::TraceInlinedFunction(Handle<SharedFunctionInfo> shared, 337 int CompilationInfo::TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
327 int raw_position) { 338 SourcePosition position) {
328 if (!FLAG_hydrogen_track_positions) { 339 if (!FLAG_hydrogen_track_positions) {
329 return 0; 340 return 0;
330 } 341 }
331 342
332 DCHECK(inlined_function_infos_); 343 DCHECK(inlined_function_infos_);
333 DCHECK(inlining_id_to_function_id_); 344 DCHECK(inlining_id_to_function_id_);
334 int id = 0; 345 int id = 0;
335 for (; id < inlined_function_infos_->length(); id++) { 346 for (; id < inlined_function_infos_->length(); id++) {
336 if (inlined_function_infos_->at(id).shared().is_identical_to(shared)) { 347 if (inlined_function_infos_->at(id).shared().is_identical_to(shared)) {
337 break; 348 break;
(...skipping 24 matching lines...) Expand all
362 } 373 }
363 } 374 }
364 } 375 }
365 376
366 int inline_id = inlining_id_to_function_id_->length(); 377 int inline_id = inlining_id_to_function_id_->length();
367 inlining_id_to_function_id_->Add(id); 378 inlining_id_to_function_id_->Add(id);
368 379
369 if (inline_id != 0) { 380 if (inline_id != 0) {
370 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); 381 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
371 OFStream os(tracing_scope.file()); 382 OFStream os(tracing_scope.file());
372 HSourcePosition position = HSourcePosition::FromRaw(raw_position);
373 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{" 383 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{"
374 << optimization_id() << "," << id << "} AS " << inline_id << " AT " 384 << optimization_id() << "," << id << "} AS " << inline_id << " AT "
375 << position << std::endl; 385 << position << std::endl;
376 } 386 }
377 387
378 return inline_id; 388 return inline_id;
379 } 389 }
380 390
381 391
382 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { 392 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder {
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 } 1600 }
1591 1601
1592 1602
1593 #if DEBUG 1603 #if DEBUG
1594 void CompilationInfo::PrintAstForTesting() { 1604 void CompilationInfo::PrintAstForTesting() {
1595 PrintF("--- Source from AST ---\n%s\n", 1605 PrintF("--- Source from AST ---\n%s\n",
1596 PrettyPrinter(isolate(), zone()).PrintProgram(function())); 1606 PrettyPrinter(isolate(), zone()).PrintProgram(function()));
1597 } 1607 }
1598 #endif 1608 #endif
1599 } } // namespace v8::internal 1609 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698