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

Side by Side Diff: src/hydrogen.cc

Issue 618643002: Replace OStream with std::ostream. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-dce.cc » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <sstream>
8 9
9 #include "src/v8.h" 10 #include "src/v8.h"
10 11
11 #include "src/allocation-site-scopes.h" 12 #include "src/allocation-site-scopes.h"
12 #include "src/codegen.h" 13 #include "src/codegen.h"
13 #include "src/full-codegen.h" 14 #include "src/full-codegen.h"
14 #include "src/hashmap.h" 15 #include "src/hashmap.h"
15 #include "src/hydrogen-bce.h" 16 #include "src/hydrogen-bce.h"
16 #include "src/hydrogen-bch.h" 17 #include "src/hydrogen-bch.h"
17 #include "src/hydrogen-canonicalize.h" 18 #include "src/hydrogen-canonicalize.h"
(...skipping 3406 matching lines...) Expand 10 before | Expand all | Expand 10 after
3424 } 3425 }
3425 3426
3426 3427
3427 void HBasicBlock::FinishExit(HControlInstruction* instruction, 3428 void HBasicBlock::FinishExit(HControlInstruction* instruction,
3428 HSourcePosition position) { 3429 HSourcePosition position) {
3429 Finish(instruction, position); 3430 Finish(instruction, position);
3430 ClearEnvironment(); 3431 ClearEnvironment();
3431 } 3432 }
3432 3433
3433 3434
3434 OStream& operator<<(OStream& os, const HBasicBlock& b) { 3435 std::ostream& operator<<(std::ostream& os, const HBasicBlock& b) {
3435 return os << "B" << b.block_id(); 3436 return os << "B" << b.block_id();
3436 } 3437 }
3437 3438
3438 3439
3439 HGraph::HGraph(CompilationInfo* info) 3440 HGraph::HGraph(CompilationInfo* info)
3440 : isolate_(info->isolate()), 3441 : isolate_(info->isolate()),
3441 next_block_id_(0), 3442 next_block_id_(0),
3442 entry_block_(NULL), 3443 entry_block_(NULL),
3443 blocks_(8, info->zone()), 3444 blocks_(8, info->zone()),
3444 values_(16, info->zone()), 3445 values_(16, info->zone()),
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
3535 } 3536 }
3536 } 3537 }
3537 3538
3538 int inline_id = next_inline_id_++; 3539 int inline_id = next_inline_id_++;
3539 3540
3540 if (inline_id != 0) { 3541 if (inline_id != 0) {
3541 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); 3542 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
3542 OFStream os(tracing_scope.file()); 3543 OFStream os(tracing_scope.file());
3543 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{" 3544 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{"
3544 << info()->optimization_id() << "," << id << "} AS " << inline_id 3545 << info()->optimization_id() << "," << id << "} AS " << inline_id
3545 << " AT " << position << endl; 3546 << " AT " << position << std::endl;
3546 } 3547 }
3547 3548
3548 return inline_id; 3549 return inline_id;
3549 } 3550 }
3550 3551
3551 3552
3552 int HGraph::SourcePositionToScriptPosition(HSourcePosition pos) { 3553 int HGraph::SourcePositionToScriptPosition(HSourcePosition pos) {
3553 if (!FLAG_hydrogen_track_positions || pos.IsUnknown()) { 3554 if (!FLAG_hydrogen_track_positions || pos.IsUnknown()) {
3554 return pos.raw(); 3555 return pos.raw();
3555 } 3556 }
(...skipping 8627 matching lines...) Expand 10 before | Expand all | Expand 10 after
12183 inner->SetValueAt(arity + 1, context()); 12184 inner->SetValueAt(arity + 1, context());
12184 for (int i = arity + 2; i < inner->length(); ++i) { 12185 for (int i = arity + 2; i < inner->length(); ++i) {
12185 inner->SetValueAt(i, undefined); 12186 inner->SetValueAt(i, undefined);
12186 } 12187 }
12187 12188
12188 inner->set_ast_id(BailoutId::FunctionEntry()); 12189 inner->set_ast_id(BailoutId::FunctionEntry());
12189 return inner; 12190 return inner;
12190 } 12191 }
12191 12192
12192 12193
12193 OStream& operator<<(OStream& os, const HEnvironment& env) { 12194 std::ostream& operator<<(std::ostream& os, const HEnvironment& env) {
12194 for (int i = 0; i < env.length(); i++) { 12195 for (int i = 0; i < env.length(); i++) {
12195 if (i == 0) os << "parameters\n"; 12196 if (i == 0) os << "parameters\n";
12196 if (i == env.parameter_count()) os << "specials\n"; 12197 if (i == env.parameter_count()) os << "specials\n";
12197 if (i == env.parameter_count() + env.specials_count()) os << "locals\n"; 12198 if (i == env.parameter_count() + env.specials_count()) os << "locals\n";
12198 if (i == env.parameter_count() + env.specials_count() + env.local_count()) { 12199 if (i == env.parameter_count() + env.specials_count() + env.local_count()) {
12199 os << "expressions\n"; 12200 os << "expressions\n";
12200 } 12201 }
12201 HValue* val = env.values()->at(i); 12202 HValue* val = env.values()->at(i);
12202 os << i << ": "; 12203 os << i << ": ";
12203 if (val != NULL) { 12204 if (val != NULL) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
12315 12316
12316 { 12317 {
12317 Tag states_tag(this, "states"); 12318 Tag states_tag(this, "states");
12318 Tag locals_tag(this, "locals"); 12319 Tag locals_tag(this, "locals");
12319 int total = current->phis()->length(); 12320 int total = current->phis()->length();
12320 PrintIntProperty("size", current->phis()->length()); 12321 PrintIntProperty("size", current->phis()->length());
12321 PrintStringProperty("method", "None"); 12322 PrintStringProperty("method", "None");
12322 for (int j = 0; j < total; ++j) { 12323 for (int j = 0; j < total; ++j) {
12323 HPhi* phi = current->phis()->at(j); 12324 HPhi* phi = current->phis()->at(j);
12324 PrintIndent(); 12325 PrintIndent();
12325 OStringStream os; 12326 std::ostringstream os;
12326 os << phi->merged_index() << " " << NameOf(phi) << " " << *phi << "\n"; 12327 os << phi->merged_index() << " " << NameOf(phi) << " " << *phi << "\n";
12327 trace_.Add(os.c_str()); 12328 trace_.Add(os.str().c_str());
12328 } 12329 }
12329 } 12330 }
12330 12331
12331 { 12332 {
12332 Tag HIR_tag(this, "HIR"); 12333 Tag HIR_tag(this, "HIR");
12333 for (HInstructionIterator it(current); !it.Done(); it.Advance()) { 12334 for (HInstructionIterator it(current); !it.Done(); it.Advance()) {
12334 HInstruction* instruction = it.Current(); 12335 HInstruction* instruction = it.Current();
12335 int uses = instruction->UseCount(); 12336 int uses = instruction->UseCount();
12336 PrintIndent(); 12337 PrintIndent();
12337 OStringStream os; 12338 std::ostringstream os;
12338 os << "0 " << uses << " " << NameOf(instruction) << " " << *instruction; 12339 os << "0 " << uses << " " << NameOf(instruction) << " " << *instruction;
12339 if (FLAG_hydrogen_track_positions && 12340 if (FLAG_hydrogen_track_positions &&
12340 instruction->has_position() && 12341 instruction->has_position() &&
12341 instruction->position().raw() != 0) { 12342 instruction->position().raw() != 0) {
12342 const HSourcePosition pos = instruction->position(); 12343 const HSourcePosition pos = instruction->position();
12343 os << " pos:"; 12344 os << " pos:";
12344 if (pos.inlining_id() != 0) os << pos.inlining_id() << "_"; 12345 if (pos.inlining_id() != 0) os << pos.inlining_id() << "_";
12345 os << pos.position(); 12346 os << pos.position();
12346 } 12347 }
12347 os << " <|@\n"; 12348 os << " <|@\n";
12348 trace_.Add(os.c_str()); 12349 trace_.Add(os.str().c_str());
12349 } 12350 }
12350 } 12351 }
12351 12352
12352 12353
12353 if (chunk != NULL) { 12354 if (chunk != NULL) {
12354 Tag LIR_tag(this, "LIR"); 12355 Tag LIR_tag(this, "LIR");
12355 int first_index = current->first_instruction_index(); 12356 int first_index = current->first_instruction_index();
12356 int last_index = current->last_instruction_index(); 12357 int last_index = current->last_instruction_index();
12357 if (first_index != -1 && last_index != -1) { 12358 if (first_index != -1 && last_index != -1) {
12358 const ZoneList<LInstruction*>* instructions = chunk->instructions(); 12359 const ZoneList<LInstruction*>* instructions = chunk->instructions();
12359 for (int i = first_index; i <= last_index; ++i) { 12360 for (int i = first_index; i <= last_index; ++i) {
12360 LInstruction* linstr = instructions->at(i); 12361 LInstruction* linstr = instructions->at(i);
12361 if (linstr != NULL) { 12362 if (linstr != NULL) {
12362 PrintIndent(); 12363 PrintIndent();
12363 trace_.Add("%d ", 12364 trace_.Add("%d ",
12364 LifetimePosition::FromInstructionIndex(i).Value()); 12365 LifetimePosition::FromInstructionIndex(i).Value());
12365 linstr->PrintTo(&trace_); 12366 linstr->PrintTo(&trace_);
12366 OStringStream os; 12367 std::ostringstream os;
12367 os << " [hir:" << NameOf(linstr->hydrogen_value()) << "] <|@\n"; 12368 os << " [hir:" << NameOf(linstr->hydrogen_value()) << "] <|@\n";
12368 trace_.Add(os.c_str()); 12369 trace_.Add(os.str().c_str());
12369 } 12370 }
12370 } 12371 }
12371 } 12372 }
12372 } 12373 }
12373 } 12374 }
12374 } 12375 }
12375 12376
12376 12377
12377 void HTracer::TraceLiveRanges(const char* name, LAllocator* allocator) { 12378 void HTracer::TraceLiveRanges(const char* name, LAllocator* allocator) {
12378 Tag tag(this, "intervals"); 12379 Tag tag(this, "intervals");
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
12540 if (ShouldProduceTraceOutput()) { 12541 if (ShouldProduceTraceOutput()) {
12541 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12542 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12542 } 12543 }
12543 12544
12544 #ifdef DEBUG 12545 #ifdef DEBUG
12545 graph_->Verify(false); // No full verify. 12546 graph_->Verify(false); // No full verify.
12546 #endif 12547 #endif
12547 } 12548 }
12548 12549
12549 } } // namespace v8::internal 12550 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-dce.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698