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

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: Reduced diff 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
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) os << "_ReuseLeft";
2469 else if (mode_ == OVERWRITE_RIGHT) stream->Add("_ReuseRight"); 2468 else if (s.mode_ == OVERWRITE_RIGHT) os << "_ReuseRight";
2470 if (CouldCreateAllocationMementos()) stream->Add("_CreateAllocationMementos"); 2469 if (s.CouldCreateAllocationMementos()) os << "_CreateAllocationMementos";
2471 stream->Add(":%s*", KindToString(left_kind_)); 2470 os << ":" << BinaryOpIC::State::KindToString(s.left_kind_) << "*";
2472 if (fixed_right_arg_.has_value) { 2471 if (s.fixed_right_arg_.has_value) {
2473 stream->Add("%d", fixed_right_arg_.value); 2472 os << s.fixed_right_arg_.value;
2474 } else { 2473 } else {
2475 stream->Add("%s", KindToString(right_kind_)); 2474 os << BinaryOpIC::State::KindToString(s.right_kind_);
2476 } 2475 }
2477 stream->Add("->%s)", KindToString(result_kind_)); 2476 return os << "->" << BinaryOpIC::State::KindToString(s.result_kind_) << ")";
2478 } 2477 }
2479 2478
2480 2479
2481 void BinaryOpIC::State::Update(Handle<Object> left, 2480 void BinaryOpIC::State::Update(Handle<Object> left,
2482 Handle<Object> right, 2481 Handle<Object> right,
2483 Handle<Object> result) { 2482 Handle<Object> result) {
2484 ExtraICState old_extra_ic_state = GetExtraICState(); 2483 ExtraICState old_extra_ic_state = GetExtraICState();
2485 2484
2486 left_kind_ = UpdateKind(left, left_kind_); 2485 left_kind_ = UpdateKind(left, left_kind_);
2487 right_kind_ = UpdateKind(right, right_kind_); 2486 right_kind_ = UpdateKind(right, right_kind_);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2641 // Install the generic stub. 2640 // Install the generic stub.
2642 BinaryOpICStub stub(isolate(), state); 2641 BinaryOpICStub stub(isolate(), state);
2643 target = stub.GetCode(); 2642 target = stub.GetCode();
2644 2643
2645 // Sanity check the generic stub. 2644 // Sanity check the generic stub.
2646 ASSERT_EQ(NULL, target->FindFirstAllocationSite()); 2645 ASSERT_EQ(NULL, target->FindFirstAllocationSite());
2647 } 2646 }
2648 set_target(*target); 2647 set_target(*target);
2649 2648
2650 if (FLAG_trace_ic) { 2649 if (FLAG_trace_ic) {
2651 char buffer[150]; 2650 OFStream os(stdout);
2652 NoAllocationStringAllocator allocator( 2651 os << "[BinaryOpIC" << old_state << " => " << state << " @ "
2653 buffer, static_cast<unsigned>(sizeof(buffer))); 2652 << 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); 2653 JavaScriptFrame::PrintTop(isolate(), stdout, false, true);
2662 if (!allocation_site.is_null()) { 2654 if (!allocation_site.is_null()) {
2663 PrintF(" using allocation site %p", static_cast<void*>(*allocation_site)); 2655 os << " using allocation site " << static_cast<void*>(*allocation_site);
2664 } 2656 }
2665 PrintF("]\n"); 2657 os << "]" << endl;
2666 } 2658 }
2667 2659
2668 // Patch the inlined smi code as necessary. 2660 // Patch the inlined smi code as necessary.
2669 if (!old_state.UseInlinedSmiCode() && state.UseInlinedSmiCode()) { 2661 if (!old_state.UseInlinedSmiCode() && state.UseInlinedSmiCode()) {
2670 PatchInlinedSmiCode(address(), ENABLE_INLINED_SMI_CHECK); 2662 PatchInlinedSmiCode(address(), ENABLE_INLINED_SMI_CHECK);
2671 } else if (old_state.UseInlinedSmiCode() && !state.UseInlinedSmiCode()) { 2663 } else if (old_state.UseInlinedSmiCode() && !state.UseInlinedSmiCode()) {
2672 PatchInlinedSmiCode(address(), DISABLE_INLINED_SMI_CHECK); 2664 PatchInlinedSmiCode(address(), DISABLE_INLINED_SMI_CHECK);
2673 } 2665 }
2674 2666
2675 return result; 2667 return result;
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
3079 #undef ADDR 3071 #undef ADDR
3080 }; 3072 };
3081 3073
3082 3074
3083 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3075 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3084 return IC_utilities[id]; 3076 return IC_utilities[id];
3085 } 3077 }
3086 3078
3087 3079
3088 } } // namespace v8::internal 3080 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698