OLD | NEW |
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/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 name->ShortPrint(stdout); | 133 name->ShortPrint(stdout); |
134 #endif | 134 #endif |
135 PrintF("]\n"); | 135 PrintF("]\n"); |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 | 139 |
140 #define TRACE_IC(type, name) TraceIC(type, name) | 140 #define TRACE_IC(type, name) TraceIC(type, name) |
141 | 141 |
142 | 142 |
143 IC::IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus, | 143 IC::IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus) |
144 bool for_queries_only) | |
145 : isolate_(isolate), | 144 : isolate_(isolate), |
146 target_set_(false), | 145 target_set_(false), |
147 vector_set_(false), | 146 vector_set_(false), |
148 target_maps_set_(false), | 147 target_maps_set_(false), |
149 nexus_(nexus) { | 148 nexus_(nexus) { |
150 // To improve the performance of the (much used) IC code, we unfold a few | 149 // To improve the performance of the (much used) IC code, we unfold a few |
151 // levels of the stack frame iteration code. This yields a ~35% speedup when | 150 // levels of the stack frame iteration code. This yields a ~35% speedup when |
152 // running DeltaBlue and a ~25% speedup of gbemu with the '--nouse-ic' flag. | 151 // running DeltaBlue and a ~25% speedup of gbemu with the '--nouse-ic' flag. |
153 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top()); | 152 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top()); |
154 Address* constant_pool = NULL; | 153 Address* constant_pool = NULL; |
(...skipping 22 matching lines...) Expand all Loading... |
177 StackFrame* frame = it.frame(); | 176 StackFrame* frame = it.frame(); |
178 DCHECK(fp == frame->fp() && pc_address == frame->pc_address()); | 177 DCHECK(fp == frame->fp() && pc_address == frame->pc_address()); |
179 #endif | 178 #endif |
180 fp_ = fp; | 179 fp_ = fp; |
181 if (FLAG_enable_embedded_constant_pool) { | 180 if (FLAG_enable_embedded_constant_pool) { |
182 constant_pool_address_ = constant_pool; | 181 constant_pool_address_ = constant_pool; |
183 } | 182 } |
184 pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address); | 183 pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address); |
185 target_ = handle(raw_target(), isolate); | 184 target_ = handle(raw_target(), isolate); |
186 kind_ = target_->kind(); | 185 kind_ = target_->kind(); |
187 state_ = (!for_queries_only && UseVector()) ? nexus->StateFromFeedback() | 186 state_ = UseVector() ? nexus->StateFromFeedback() : target_->ic_state(); |
188 : target_->ic_state(); | |
189 old_state_ = state_; | 187 old_state_ = state_; |
190 extra_ic_state_ = target_->extra_ic_state(); | 188 extra_ic_state_ = target_->extra_ic_state(); |
191 } | 189 } |
192 | 190 |
193 | 191 |
194 SharedFunctionInfo* IC::GetSharedFunctionInfo() const { | 192 SharedFunctionInfo* IC::GetSharedFunctionInfo() const { |
195 // Compute the JavaScript frame for the frame pointer of this IC | 193 // Compute the JavaScript frame for the frame pointer of this IC |
196 // structure. We need this to be able to find the function | 194 // structure. We need this to be able to find the function |
197 // corresponding to the frame. | 195 // corresponding to the frame. |
198 StackFrameIterator it(isolate()); | 196 StackFrameIterator it(isolate()); |
(...skipping 2796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2995 Handle<Object> result; | 2993 Handle<Object> result; |
2996 LookupIterator it(receiver, name, holder); | 2994 LookupIterator it(receiver, name, holder); |
2997 // TODO(conradw): Investigate strong mode semantics for this. | 2995 // TODO(conradw): Investigate strong mode semantics for this. |
2998 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 2996 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
2999 JSObject::GetProperty(&it)); | 2997 JSObject::GetProperty(&it)); |
3000 | 2998 |
3001 if (it.IsFound()) return *result; | 2999 if (it.IsFound()) return *result; |
3002 | 3000 |
3003 // Return the undefined result if the reference error should not be thrown. | 3001 // Return the undefined result if the reference error should not be thrown. |
3004 // Note that both keyed and non-keyed loads may end up here. | 3002 // Note that both keyed and non-keyed loads may end up here. |
3005 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true); | 3003 LoadICNexus nexus(isolate); |
| 3004 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
3006 if (!ic.ShouldThrowReferenceError(it.GetReceiver())) { | 3005 if (!ic.ShouldThrowReferenceError(it.GetReceiver())) { |
3007 return isolate->heap()->undefined_value(); | 3006 return isolate->heap()->undefined_value(); |
3008 } | 3007 } |
3009 | 3008 |
3010 // Throw a reference error. | 3009 // Throw a reference error. |
3011 THROW_NEW_ERROR_RETURN_FAILURE( | 3010 THROW_NEW_ERROR_RETURN_FAILURE( |
3012 isolate, NewReferenceError(MessageTemplate::kNotDefined, it.name())); | 3011 isolate, NewReferenceError(MessageTemplate::kNotDefined, it.name())); |
3013 } | 3012 } |
3014 | 3013 |
3015 | 3014 |
3016 RUNTIME_FUNCTION(Runtime_StorePropertyWithInterceptor) { | 3015 RUNTIME_FUNCTION(Runtime_StorePropertyWithInterceptor) { |
3017 HandleScope scope(isolate); | 3016 HandleScope scope(isolate); |
3018 DCHECK(args.length() == 3); | 3017 DCHECK(args.length() == 3); |
3019 StoreIC ic(IC::NO_EXTRA_FRAME, isolate); | 3018 StoreICNexus nexus(isolate); |
| 3019 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
3020 Handle<JSObject> receiver = args.at<JSObject>(0); | 3020 Handle<JSObject> receiver = args.at<JSObject>(0); |
3021 Handle<Name> name = args.at<Name>(1); | 3021 Handle<Name> name = args.at<Name>(1); |
3022 Handle<Object> value = args.at<Object>(2); | 3022 Handle<Object> value = args.at<Object>(2); |
3023 #ifdef DEBUG | 3023 #ifdef DEBUG |
3024 PrototypeIterator iter(isolate, receiver, | 3024 PrototypeIterator iter(isolate, receiver, |
3025 PrototypeIterator::START_AT_RECEIVER); | 3025 PrototypeIterator::START_AT_RECEIVER); |
3026 bool found = false; | 3026 bool found = false; |
3027 for (; !iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN); iter.Advance()) { | 3027 for (; !iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN); iter.Advance()) { |
3028 Handle<Object> current = PrototypeIterator::GetCurrent(iter); | 3028 Handle<Object> current = PrototypeIterator::GetCurrent(iter); |
3029 if (current->IsJSObject() && | 3029 if (current->IsJSObject() && |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3082 KeyedLoadICNexus nexus(vector, vector_slot); | 3082 KeyedLoadICNexus nexus(vector, vector_slot); |
3083 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 3083 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
3084 ic.UpdateState(receiver, key); | 3084 ic.UpdateState(receiver, key); |
3085 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 3085 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
3086 } | 3086 } |
3087 | 3087 |
3088 return *result; | 3088 return *result; |
3089 } | 3089 } |
3090 } // namespace internal | 3090 } // namespace internal |
3091 } // namespace v8 | 3091 } // namespace v8 |
OLD | NEW |