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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 #ifdef DEBUG | 141 #ifdef DEBUG |
142 StackFrameIterator it(isolate); | 142 StackFrameIterator it(isolate); |
143 for (int i = 0; i < depth + 1; i++) it.Advance(); | 143 for (int i = 0; i < depth + 1; i++) it.Advance(); |
144 StackFrame* frame = it.frame(); | 144 StackFrame* frame = it.frame(); |
145 ASSERT(fp == frame->fp() && pc_address == frame->pc_address()); | 145 ASSERT(fp == frame->fp() && pc_address == frame->pc_address()); |
146 #endif | 146 #endif |
147 fp_ = fp; | 147 fp_ = fp; |
148 pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address); | 148 pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address); |
149 target_ = handle(raw_target(), isolate); | 149 target_ = handle(raw_target(), isolate); |
150 state_ = target_->ic_state(); | 150 state_ = target_->ic_state(); |
151 extra_ic_state_ = target_->needs_extended_extra_ic_state(target_->kind()) | 151 extra_ic_state_ = target_->extra_ic_state(); |
152 ? target_->extended_extra_ic_state() | |
153 : target_->extra_ic_state(); | |
154 } | 152 } |
155 | 153 |
156 | 154 |
157 #ifdef ENABLE_DEBUGGER_SUPPORT | 155 #ifdef ENABLE_DEBUGGER_SUPPORT |
158 Address IC::OriginalCodeAddress() const { | 156 Address IC::OriginalCodeAddress() const { |
159 HandleScope scope(isolate()); | 157 HandleScope scope(isolate()); |
160 // Compute the JavaScript frame for the frame pointer of this IC | 158 // Compute the JavaScript frame for the frame pointer of this IC |
161 // structure. We need this to be able to find the function | 159 // structure. We need this to be able to find the function |
162 // corresponding to the frame. | 160 // corresponding to the frame. |
163 StackFrameIterator it(isolate()); | 161 StackFrameIterator it(isolate()); |
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2364 case GENERIC: return Type::Any(zone); | 2362 case GENERIC: return Type::Any(zone); |
2365 } | 2363 } |
2366 UNREACHABLE(); | 2364 UNREACHABLE(); |
2367 return NULL; | 2365 return NULL; |
2368 } | 2366 } |
2369 | 2367 |
2370 | 2368 |
2371 MaybeObject* BinaryOpIC::Transition(Handle<AllocationSite> allocation_site, | 2369 MaybeObject* BinaryOpIC::Transition(Handle<AllocationSite> allocation_site, |
2372 Handle<Object> left, | 2370 Handle<Object> left, |
2373 Handle<Object> right) { | 2371 Handle<Object> right) { |
2374 State state(target()->extended_extra_ic_state()); | 2372 State state(target()->extra_ic_state()); |
2375 | 2373 |
2376 // Compute the actual result using the builtin for the binary operation. | 2374 // Compute the actual result using the builtin for the binary operation. |
2377 Object* builtin = isolate()->js_builtins_object()->javascript_builtin( | 2375 Object* builtin = isolate()->js_builtins_object()->javascript_builtin( |
2378 TokenToJSBuiltin(state.op())); | 2376 TokenToJSBuiltin(state.op())); |
2379 Handle<JSFunction> function = handle(JSFunction::cast(builtin), isolate()); | 2377 Handle<JSFunction> function = handle(JSFunction::cast(builtin), isolate()); |
2380 bool caught_exception; | 2378 bool caught_exception; |
2381 Handle<Object> result = Execution::Call( | 2379 Handle<Object> result = Execution::Call( |
2382 isolate(), function, left, 1, &right, &caught_exception); | 2380 isolate(), function, left, 1, &right, &caught_exception); |
2383 if (caught_exception) return Failure::Exception(); | 2381 if (caught_exception) return Failure::Exception(); |
2384 | 2382 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2680 RUNTIME_FUNCTION(Code*, CompareIC_Miss) { | 2678 RUNTIME_FUNCTION(Code*, CompareIC_Miss) { |
2681 HandleScope scope(isolate); | 2679 HandleScope scope(isolate); |
2682 ASSERT(args.length() == 3); | 2680 ASSERT(args.length() == 3); |
2683 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); | 2681 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); |
2684 return ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); | 2682 return ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); |
2685 } | 2683 } |
2686 | 2684 |
2687 | 2685 |
2688 void CompareNilIC::Clear(Address address, Code* target) { | 2686 void CompareNilIC::Clear(Address address, Code* target) { |
2689 if (IsCleared(target)) return; | 2687 if (IsCleared(target)) return; |
2690 ExtraICState state = target->extended_extra_ic_state(); | 2688 ExtraICState state = target->extra_ic_state(); |
2691 | 2689 |
2692 CompareNilICStub stub(state, HydrogenCodeStub::UNINITIALIZED); | 2690 CompareNilICStub stub(state, HydrogenCodeStub::UNINITIALIZED); |
2693 stub.ClearState(); | 2691 stub.ClearState(); |
2694 | 2692 |
2695 Code* code = NULL; | 2693 Code* code = NULL; |
2696 CHECK(stub.FindCodeInCache(&code, target->GetIsolate())); | 2694 CHECK(stub.FindCodeInCache(&code, target->GetIsolate())); |
2697 | 2695 |
2698 SetTargetAtAddress(address, code); | 2696 SetTargetAtAddress(address, code); |
2699 } | 2697 } |
2700 | 2698 |
2701 | 2699 |
2702 MaybeObject* CompareNilIC::DoCompareNilSlow(NilValue nil, | 2700 MaybeObject* CompareNilIC::DoCompareNilSlow(NilValue nil, |
2703 Handle<Object> object) { | 2701 Handle<Object> object) { |
2704 if (object->IsNull() || object->IsUndefined()) { | 2702 if (object->IsNull() || object->IsUndefined()) { |
2705 return Smi::FromInt(true); | 2703 return Smi::FromInt(true); |
2706 } | 2704 } |
2707 return Smi::FromInt(object->IsUndetectableObject()); | 2705 return Smi::FromInt(object->IsUndetectableObject()); |
2708 } | 2706 } |
2709 | 2707 |
2710 | 2708 |
2711 MaybeObject* CompareNilIC::CompareNil(Handle<Object> object) { | 2709 MaybeObject* CompareNilIC::CompareNil(Handle<Object> object) { |
2712 ExtraICState extra_ic_state = target()->extended_extra_ic_state(); | 2710 ExtraICState extra_ic_state = target()->extra_ic_state(); |
2713 | 2711 |
2714 CompareNilICStub stub(extra_ic_state); | 2712 CompareNilICStub stub(extra_ic_state); |
2715 | 2713 |
2716 // Extract the current supported types from the patched IC and calculate what | 2714 // Extract the current supported types from the patched IC and calculate what |
2717 // types must be supported as a result of the miss. | 2715 // types must be supported as a result of the miss. |
2718 bool already_monomorphic = stub.IsMonomorphic(); | 2716 bool already_monomorphic = stub.IsMonomorphic(); |
2719 | 2717 |
2720 stub.UpdateStatus(object); | 2718 stub.UpdateStatus(object); |
2721 | 2719 |
2722 NilValue nil = stub.GetNilValue(); | 2720 NilValue nil = stub.GetNilValue(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2786 return Builtins::SHR; | 2784 return Builtins::SHR; |
2787 break; | 2785 break; |
2788 case Token::SHL: | 2786 case Token::SHL: |
2789 return Builtins::SHL; | 2787 return Builtins::SHL; |
2790 break; | 2788 break; |
2791 } | 2789 } |
2792 } | 2790 } |
2793 | 2791 |
2794 | 2792 |
2795 MaybeObject* ToBooleanIC::ToBoolean(Handle<Object> object) { | 2793 MaybeObject* ToBooleanIC::ToBoolean(Handle<Object> object) { |
2796 ToBooleanStub stub(target()->extended_extra_ic_state()); | 2794 ToBooleanStub stub(target()->extra_ic_state()); |
2797 bool to_boolean_value = stub.UpdateStatus(object); | 2795 bool to_boolean_value = stub.UpdateStatus(object); |
2798 Handle<Code> code = stub.GetCode(isolate()); | 2796 Handle<Code> code = stub.GetCode(isolate()); |
2799 set_target(*code); | 2797 set_target(*code); |
2800 return Smi::FromInt(to_boolean_value ? 1 : 0); | 2798 return Smi::FromInt(to_boolean_value ? 1 : 0); |
2801 } | 2799 } |
2802 | 2800 |
2803 | 2801 |
2804 RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss) { | 2802 RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss) { |
2805 ASSERT(args.length() == 1); | 2803 ASSERT(args.length() == 1); |
2806 HandleScope scope(isolate); | 2804 HandleScope scope(isolate); |
(...skipping 10 matching lines...) Expand all Loading... |
2817 #undef ADDR | 2815 #undef ADDR |
2818 }; | 2816 }; |
2819 | 2817 |
2820 | 2818 |
2821 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2819 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2822 return IC_utilities[id]; | 2820 return IC_utilities[id]; |
2823 } | 2821 } |
2824 | 2822 |
2825 | 2823 |
2826 } } // namespace v8::internal | 2824 } } // namespace v8::internal |
OLD | NEW |