| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/ic/call-optimization.h" | 7 #include "src/ic/call-optimization.h" |
| 8 #include "src/ic/handler-compiler.h" | 8 #include "src/ic/handler-compiler.h" |
| 9 #include "src/ic/ic-inl.h" | 9 #include "src/ic/ic-inl.h" |
| 10 | 10 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 scratch1(), false, 0, NULL); | 218 scratch1(), false, 0, NULL); |
| 219 return GetCode(kind(), Code::FAST, name); | 219 return GetCode(kind(), Code::FAST, name); |
| 220 } | 220 } |
| 221 | 221 |
| 222 | 222 |
| 223 Handle<Code> NamedLoadHandlerCompiler::CompileLoadInterceptor( | 223 Handle<Code> NamedLoadHandlerCompiler::CompileLoadInterceptor( |
| 224 LookupIterator* it) { | 224 LookupIterator* it) { |
| 225 // So far the most popular follow ups for interceptor loads are FIELD and | 225 // So far the most popular follow ups for interceptor loads are FIELD and |
| 226 // ExecutableAccessorInfo, so inline only them. Other cases may be added | 226 // ExecutableAccessorInfo, so inline only them. Other cases may be added |
| 227 // later. | 227 // later. |
| 228 bool inline_followup = it->state() == LookupIterator::PROPERTY; | 228 bool inline_followup = false; |
| 229 if (inline_followup) { | 229 switch (it->state()) { |
| 230 switch (it->property_kind()) { | 230 case LookupIterator::TRANSITION: |
| 231 case LookupIterator::DATA: | 231 case LookupIterator::UNKNOWN: |
| 232 inline_followup = it->property_details().type() == FIELD; | 232 UNREACHABLE(); |
| 233 break; | 233 case LookupIterator::ACCESS_CHECK: |
| 234 case LookupIterator::ACCESSOR: { | 234 case LookupIterator::INTERCEPTOR: |
| 235 Handle<Object> accessors = it->GetAccessors(); | 235 case LookupIterator::JSPROXY: |
| 236 inline_followup = accessors->IsExecutableAccessorInfo(); | 236 case LookupIterator::NOT_FOUND: |
| 237 if (!inline_followup) break; | 237 break; |
| 238 Handle<ExecutableAccessorInfo> info = | 238 case LookupIterator::DATA: |
| 239 Handle<ExecutableAccessorInfo>::cast(accessors); | 239 inline_followup = it->property_details().type() == FIELD; |
| 240 inline_followup = info->getter() != NULL && | 240 break; |
| 241 ExecutableAccessorInfo::IsCompatibleReceiverType( | 241 case LookupIterator::ACCESSOR: { |
| 242 isolate(), info, type()); | 242 Handle<Object> accessors = it->GetAccessors(); |
| 243 } | 243 inline_followup = accessors->IsExecutableAccessorInfo(); |
| 244 if (!inline_followup) break; |
| 245 Handle<ExecutableAccessorInfo> info = |
| 246 Handle<ExecutableAccessorInfo>::cast(accessors); |
| 247 inline_followup = info->getter() != NULL && |
| 248 ExecutableAccessorInfo::IsCompatibleReceiverType( |
| 249 isolate(), info, type()); |
| 244 } | 250 } |
| 245 } | 251 } |
| 246 | 252 |
| 247 Register reg = Frontend(receiver(), it->name()); | 253 Register reg = Frontend(receiver(), it->name()); |
| 248 if (inline_followup) { | 254 if (inline_followup) { |
| 249 // TODO(368): Compile in the whole chain: all the interceptors in | 255 // TODO(368): Compile in the whole chain: all the interceptors in |
| 250 // prototypes and ultimate answer. | 256 // prototypes and ultimate answer. |
| 251 GenerateLoadInterceptorWithFollowup(it, reg); | 257 GenerateLoadInterceptorWithFollowup(it, reg); |
| 252 } else { | 258 } else { |
| 253 GenerateLoadInterceptor(reg); | 259 GenerateLoadInterceptor(reg); |
| 254 } | 260 } |
| 255 return GetCode(kind(), Code::FAST, it->name()); | 261 return GetCode(kind(), Code::FAST, it->name()); |
| 256 } | 262 } |
| 257 | 263 |
| 258 | 264 |
| 259 void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor( | 265 void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor( |
| 260 LookupIterator* it, Register interceptor_reg) { | 266 LookupIterator* it, Register interceptor_reg) { |
| 261 Handle<JSObject> real_named_property_holder(it->GetHolder<JSObject>()); | 267 Handle<JSObject> real_named_property_holder(it->GetHolder<JSObject>()); |
| 262 | 268 |
| 263 set_type_for_object(holder()); | 269 set_type_for_object(holder()); |
| 264 set_holder(real_named_property_holder); | 270 set_holder(real_named_property_holder); |
| 265 Register reg = Frontend(interceptor_reg, it->name()); | 271 Register reg = Frontend(interceptor_reg, it->name()); |
| 266 | 272 |
| 267 switch (it->property_kind()) { | 273 switch (it->state()) { |
| 274 case LookupIterator::ACCESS_CHECK: |
| 275 case LookupIterator::INTERCEPTOR: |
| 276 case LookupIterator::JSPROXY: |
| 277 case LookupIterator::NOT_FOUND: |
| 278 case LookupIterator::TRANSITION: |
| 279 case LookupIterator::UNKNOWN: |
| 280 UNREACHABLE(); |
| 268 case LookupIterator::DATA: { | 281 case LookupIterator::DATA: { |
| 269 DCHECK_EQ(FIELD, it->property_details().type()); | 282 DCHECK_EQ(FIELD, it->property_details().type()); |
| 270 __ Move(receiver(), reg); | 283 __ Move(receiver(), reg); |
| 271 LoadFieldStub stub(isolate(), it->GetFieldIndex()); | 284 LoadFieldStub stub(isolate(), it->GetFieldIndex()); |
| 272 GenerateTailCall(masm(), stub.GetCode()); | 285 GenerateTailCall(masm(), stub.GetCode()); |
| 273 break; | 286 break; |
| 274 } | 287 } |
| 275 case LookupIterator::ACCESSOR: | 288 case LookupIterator::ACCESSOR: |
| 276 Handle<ExecutableAccessorInfo> info = | 289 Handle<ExecutableAccessorInfo> info = |
| 277 Handle<ExecutableAccessorInfo>::cast(it->GetAccessors()); | 290 Handle<ExecutableAccessorInfo>::cast(it->GetAccessors()); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 DCHECK(elements_kind == DICTIONARY_ELEMENTS); | 396 DCHECK(elements_kind == DICTIONARY_ELEMENTS); |
| 384 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); | 397 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); |
| 385 } | 398 } |
| 386 } | 399 } |
| 387 | 400 |
| 388 handlers->Add(cached_stub); | 401 handlers->Add(cached_stub); |
| 389 } | 402 } |
| 390 } | 403 } |
| 391 } | 404 } |
| 392 } // namespace v8::internal | 405 } // namespace v8::internal |
| OLD | NEW |