OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 27 matching lines...) Expand all Loading... |
38 namespace internal { | 38 namespace internal { |
39 | 39 |
40 | 40 |
41 CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor() | 41 CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor() |
42 : register_param_count_(-1), | 42 : register_param_count_(-1), |
43 stack_parameter_count_(NULL), | 43 stack_parameter_count_(NULL), |
44 hint_stack_parameter_count_(-1), | 44 hint_stack_parameter_count_(-1), |
45 function_mode_(NOT_JS_FUNCTION_STUB_MODE), | 45 function_mode_(NOT_JS_FUNCTION_STUB_MODE), |
46 register_params_(NULL), | 46 register_params_(NULL), |
47 deoptimization_handler_(NULL), | 47 deoptimization_handler_(NULL), |
48 miss_handler_(IC_Utility(IC::kUnreachable), Isolate::Current()) { } | 48 miss_handler_(IC_Utility(IC::kUnreachable), Isolate::Current()), |
| 49 has_miss_handler_(false) { } |
49 | 50 |
50 | 51 |
51 bool CodeStub::FindCodeInCache(Code** code_out, Isolate* isolate) { | 52 bool CodeStub::FindCodeInCache(Code** code_out, Isolate* isolate) { |
52 UnseededNumberDictionary* stubs = isolate->heap()->code_stubs(); | 53 UnseededNumberDictionary* stubs = isolate->heap()->code_stubs(); |
53 int index = stubs->FindEntry(GetKey()); | 54 int index = stubs->FindEntry(GetKey()); |
54 if (index != UnseededNumberDictionary::kNotFound) { | 55 if (index != UnseededNumberDictionary::kNotFound) { |
55 *code_out = Code::cast(stubs->ValueAt(index)); | 56 *code_out = Code::cast(stubs->ValueAt(index)); |
56 return true; | 57 return true; |
57 } | 58 } |
58 return false; | 59 return false; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 break; | 404 break; |
404 case CompareIC::GENERIC: | 405 case CompareIC::GENERIC: |
405 GenerateGeneric(masm); | 406 GenerateGeneric(masm); |
406 break; | 407 break; |
407 } | 408 } |
408 } | 409 } |
409 | 410 |
410 | 411 |
411 void CompareNilICStub::Record(Handle<Object> object) { | 412 void CompareNilICStub::Record(Handle<Object> object) { |
412 ASSERT(types_ != Types::FullCompare()); | 413 ASSERT(types_ != Types::FullCompare()); |
| 414 Types old_types(types_); |
413 if (equality_kind_ == kStrictEquality) { | 415 if (equality_kind_ == kStrictEquality) { |
414 // When testing for strict equality only one value will evaluate to true | 416 // When testing for strict equality only one value will evaluate to true |
415 types_.RemoveAll(); | 417 types_.RemoveAll(); |
416 types_.Add((nil_value_ == kNullValue) ? NULL_TYPE: | 418 types_.Add((nil_value_ == kNullValue) ? NULL_TYPE: |
417 UNDEFINED); | 419 UNDEFINED); |
418 } else { | 420 } else { |
419 if (object->IsNull()) { | 421 if (object->IsNull()) { |
420 types_.Add(NULL_TYPE); | 422 types_.Add(NULL_TYPE); |
421 } else if (object->IsUndefined()) { | 423 } else if (object->IsUndefined()) { |
422 types_.Add(UNDEFINED); | 424 types_.Add(UNDEFINED); |
423 } else if (object->IsUndetectableObject() || | 425 } else if (object->IsUndetectableObject() || |
424 object->IsOddball() || | 426 object->IsOddball() || |
425 !object->IsHeapObject()) { | 427 !object->IsHeapObject()) { |
426 types_ = Types::FullCompare(); | 428 types_ = Types::FullCompare(); |
427 } else if (IsMonomorphic()) { | 429 } else if (IsMonomorphic()) { |
428 types_ = Types::FullCompare(); | 430 types_ = Types::FullCompare(); |
429 } else { | 431 } else { |
430 types_.Add(MONOMORPHIC_MAP); | 432 types_.Add(MONOMORPHIC_MAP); |
431 } | 433 } |
432 } | 434 } |
| 435 old_types.TraceTransition(types_); |
433 } | 436 } |
434 | 437 |
435 | 438 |
| 439 void CompareNilICStub::Types::TraceTransition(Types to) const { |
| 440 if (!FLAG_trace_ic) return; |
| 441 char buffer[100]; |
| 442 NoAllocationStringAllocator allocator(buffer, |
| 443 static_cast<unsigned>(sizeof(buffer))); |
| 444 StringStream stream(&allocator); |
| 445 stream.Add("[CompareNilIC ("); |
| 446 Print(&stream); |
| 447 stream.Add("->"); |
| 448 to.Print(&stream); |
| 449 stream.Add(")]\n"); |
| 450 stream.OutputToStdOut(); |
| 451 } |
| 452 |
| 453 |
436 void CompareNilICStub::PrintName(StringStream* stream) { | 454 void CompareNilICStub::PrintName(StringStream* stream) { |
437 stream->Add("CompareNilICStub_"); | 455 stream->Add("CompareNilICStub_"); |
438 types_.Print(stream); | 456 types_.Print(stream); |
439 stream->Add((nil_value_ == kNullValue) ? "(NullValue|": | 457 stream->Add((nil_value_ == kNullValue) ? "(NullValue|": |
440 "(UndefinedValue|"); | 458 "(UndefinedValue|"); |
441 stream->Add((equality_kind_ == kStrictEquality) ? "StrictEquality)": | 459 stream->Add((equality_kind_ == kStrictEquality) ? "StrictEquality)": |
442 "NonStrictEquality)"); | 460 "NonStrictEquality)"); |
443 } | 461 } |
444 | 462 |
445 | 463 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 } else if (argument_count >= 2) { | 761 } else if (argument_count >= 2) { |
744 argument_count_ = MORE_THAN_ONE; | 762 argument_count_ = MORE_THAN_ONE; |
745 } else { | 763 } else { |
746 UNREACHABLE(); | 764 UNREACHABLE(); |
747 } | 765 } |
748 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 766 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
749 } | 767 } |
750 | 768 |
751 | 769 |
752 } } // namespace v8::internal | 770 } } // namespace v8::internal |
OLD | NEW |