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

Side by Side Diff: src/ic.cc

Issue 334763003: Start using OStreams. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Reformatted. Feedback addressed. Created 6 years, 5 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/ic.h ('k') | src/isolate.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/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 ASSIGN_RETURN_ON_EXCEPTION( 1338 ASSIGN_RETURN_ON_EXCEPTION(
1339 isolate(), 1339 isolate(),
1340 result, 1340 result,
1341 JSReceiver::SetProperty( 1341 JSReceiver::SetProperty(
1342 receiver, name, value, NONE, strict_mode(), store_mode), 1342 receiver, name, value, NONE, strict_mode(), store_mode),
1343 Object); 1343 Object);
1344 return result; 1344 return result;
1345 } 1345 }
1346 1346
1347 1347
1348 void CallIC::State::Print(StringStream* stream) const { 1348 OStream& operator<<(OStream& os, const CallIC::State& s) {
1349 stream->Add("(args(%d), ", 1349 return os << "(args(" << s.arg_count() << "), "
1350 argc_); 1350 << (s.call_type() == CallIC::METHOD ? "METHOD" : "FUNCTION")
1351 stream->Add("%s, ", 1351 << ", ";
1352 call_type_ == CallIC::METHOD ? "METHOD" : "FUNCTION");
1353 } 1352 }
1354 1353
1355 1354
1356 Handle<Code> CallIC::initialize_stub(Isolate* isolate, 1355 Handle<Code> CallIC::initialize_stub(Isolate* isolate,
1357 int argc, 1356 int argc,
1358 CallType call_type) { 1357 CallType call_type) {
1359 CallICStub stub(isolate, State(argc, call_type)); 1358 CallICStub stub(isolate, State(argc, call_type));
1360 Handle<Code> code = stub.GetCode(); 1359 Handle<Code> code = stub.GetCode();
1361 return code; 1360 return code;
1362 } 1361 }
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 } else if (result_kind == GENERIC && op_ == Token::ADD) { 2455 } else if (result_kind == GENERIC && op_ == Token::ADD) {
2457 return Type::Union(Type::Number(zone), Type::String(zone), zone); 2456 return Type::Union(Type::Number(zone), Type::String(zone), zone);
2458 } else if (result_kind == NUMBER && op_ == Token::SHR) { 2457 } else if (result_kind == NUMBER && op_ == Token::SHR) {
2459 return Type::Unsigned32(zone); 2458 return Type::Unsigned32(zone);
2460 } 2459 }
2461 ASSERT_NE(GENERIC, result_kind); 2460 ASSERT_NE(GENERIC, result_kind);
2462 return KindToType(result_kind, zone); 2461 return KindToType(result_kind, zone);
2463 } 2462 }
2464 2463
2465 2464
2466 void BinaryOpIC::State::Print(StringStream* stream) const { 2465 OStream& operator<<(OStream& os, const BinaryOpIC::State& s) {
2467 stream->Add("(%s", Token::Name(op_)); 2466 os << "(" << Token::Name(s.op_);
2468 if (mode_ == OVERWRITE_LEFT) stream->Add("_ReuseLeft"); 2467 if (s.mode_ == OVERWRITE_LEFT)
2469 else if (mode_ == OVERWRITE_RIGHT) stream->Add("_ReuseRight"); 2468 os << "_ReuseLeft";
2470 if (CouldCreateAllocationMementos()) stream->Add("_CreateAllocationMementos"); 2469 else if (s.mode_ == OVERWRITE_RIGHT)
2471 stream->Add(":%s*", KindToString(left_kind_)); 2470 os << "_ReuseRight";
2472 if (fixed_right_arg_.has_value) { 2471 if (s.CouldCreateAllocationMementos()) os << "_CreateAllocationMementos";
2473 stream->Add("%d", fixed_right_arg_.value); 2472 os << ":" << BinaryOpIC::State::KindToString(s.left_kind_) << "*";
2473 if (s.fixed_right_arg_.has_value) {
2474 os << s.fixed_right_arg_.value;
2474 } else { 2475 } else {
2475 stream->Add("%s", KindToString(right_kind_)); 2476 os << BinaryOpIC::State::KindToString(s.right_kind_);
2476 } 2477 }
2477 stream->Add("->%s)", KindToString(result_kind_)); 2478 return os << "->" << BinaryOpIC::State::KindToString(s.result_kind_) << ")";
2478 } 2479 }
2479 2480
2480 2481
2481 void BinaryOpIC::State::Update(Handle<Object> left, 2482 void BinaryOpIC::State::Update(Handle<Object> left,
2482 Handle<Object> right, 2483 Handle<Object> right,
2483 Handle<Object> result) { 2484 Handle<Object> result) {
2484 ExtraICState old_extra_ic_state = GetExtraICState(); 2485 ExtraICState old_extra_ic_state = GetExtraICState();
2485 2486
2486 left_kind_ = UpdateKind(left, left_kind_); 2487 left_kind_ = UpdateKind(left, left_kind_);
2487 right_kind_ = UpdateKind(right, right_kind_); 2488 right_kind_ = UpdateKind(right, right_kind_);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2641 // Install the generic stub. 2642 // Install the generic stub.
2642 BinaryOpICStub stub(isolate(), state); 2643 BinaryOpICStub stub(isolate(), state);
2643 target = stub.GetCode(); 2644 target = stub.GetCode();
2644 2645
2645 // Sanity check the generic stub. 2646 // Sanity check the generic stub.
2646 ASSERT_EQ(NULL, target->FindFirstAllocationSite()); 2647 ASSERT_EQ(NULL, target->FindFirstAllocationSite());
2647 } 2648 }
2648 set_target(*target); 2649 set_target(*target);
2649 2650
2650 if (FLAG_trace_ic) { 2651 if (FLAG_trace_ic) {
2651 char buffer[150]; 2652 OFStream os(stdout);
2652 NoAllocationStringAllocator allocator( 2653 os << "[BinaryOpIC" << old_state << " => " << state << " @ "
2653 buffer, static_cast<unsigned>(sizeof(buffer))); 2654 << static_cast<void*>(*target) << " <- ";
2654 StringStream stream(&allocator);
2655 stream.Add("[BinaryOpIC");
2656 old_state.Print(&stream);
2657 stream.Add(" => ");
2658 state.Print(&stream);
2659 stream.Add(" @ %p <- ", static_cast<void*>(*target));
2660 stream.OutputToStdOut();
2661 JavaScriptFrame::PrintTop(isolate(), stdout, false, true); 2655 JavaScriptFrame::PrintTop(isolate(), stdout, false, true);
2662 if (!allocation_site.is_null()) { 2656 if (!allocation_site.is_null()) {
2663 PrintF(" using allocation site %p", static_cast<void*>(*allocation_site)); 2657 os << " using allocation site " << static_cast<void*>(*allocation_site);
2664 } 2658 }
2665 PrintF("]\n"); 2659 os << "]" << endl;
2666 } 2660 }
2667 2661
2668 // Patch the inlined smi code as necessary. 2662 // Patch the inlined smi code as necessary.
2669 if (!old_state.UseInlinedSmiCode() && state.UseInlinedSmiCode()) { 2663 if (!old_state.UseInlinedSmiCode() && state.UseInlinedSmiCode()) {
2670 PatchInlinedSmiCode(address(), ENABLE_INLINED_SMI_CHECK); 2664 PatchInlinedSmiCode(address(), ENABLE_INLINED_SMI_CHECK);
2671 } else if (old_state.UseInlinedSmiCode() && !state.UseInlinedSmiCode()) { 2665 } else if (old_state.UseInlinedSmiCode() && !state.UseInlinedSmiCode()) {
2672 PatchInlinedSmiCode(address(), DISABLE_INLINED_SMI_CHECK); 2666 PatchInlinedSmiCode(address(), DISABLE_INLINED_SMI_CHECK);
2673 } 2667 }
2674 2668
2675 return result; 2669 return result;
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
3079 #undef ADDR 3073 #undef ADDR
3080 }; 3074 };
3081 3075
3082 3076
3083 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3077 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3084 return IC_utilities[id]; 3078 return IC_utilities[id];
3085 } 3079 }
3086 3080
3087 3081
3088 } } // namespace v8::internal 3082 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698