| 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/ic/handler-compiler.h" | 5 #include "src/ic/handler-compiler.h" |
| 6 | 6 |
| 7 #include "src/field-type.h" | 7 #include "src/field-type.h" |
| 8 #include "src/ic/call-optimization.h" | 8 #include "src/ic/call-optimization.h" |
| 9 #include "src/ic/ic-inl.h" | 9 #include "src/ic/ic-inl.h" |
| 10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 214 } |
| 215 NonexistentFrontendHeader(name, &miss, scratch2(), scratch3()); | 215 NonexistentFrontendHeader(name, &miss, scratch2(), scratch3()); |
| 216 if (IC::ICUseVector(kind())) { | 216 if (IC::ICUseVector(kind())) { |
| 217 DiscardVectorAndSlot(); | 217 DiscardVectorAndSlot(); |
| 218 } | 218 } |
| 219 GenerateLoadConstant(isolate()->factory()->undefined_value()); | 219 GenerateLoadConstant(isolate()->factory()->undefined_value()); |
| 220 FrontendFooter(name, &miss); | 220 FrontendFooter(name, &miss); |
| 221 return GetCode(kind(), name); | 221 return GetCode(kind(), name); |
| 222 } | 222 } |
| 223 | 223 |
| 224 | |
| 225 Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback( | 224 Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback( |
| 226 Handle<Name> name, Handle<AccessorInfo> callback) { | 225 Handle<Name> name, Handle<AccessorInfo> callback, Handle<Code> slow_stub) { |
| 226 if (FLAG_runtime_call_stats) { |
| 227 GenerateTailCall(masm(), slow_stub); |
| 228 } |
| 227 Register reg = Frontend(name); | 229 Register reg = Frontend(name); |
| 228 if (FLAG_runtime_call_stats) { | 230 GenerateLoadCallback(reg, callback); |
| 229 TailCallBuiltin(masm(), Builtins::kLoadIC_Slow); | |
| 230 } else { | |
| 231 GenerateLoadCallback(reg, callback); | |
| 232 } | |
| 233 return GetCode(kind(), name); | 231 return GetCode(kind(), name); |
| 234 } | 232 } |
| 235 | 233 |
| 236 | |
| 237 Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback( | 234 Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback( |
| 238 Handle<Name> name, const CallOptimization& call_optimization, | 235 Handle<Name> name, const CallOptimization& call_optimization, |
| 239 int accessor_index) { | 236 int accessor_index, Handle<Code> slow_stub) { |
| 240 DCHECK(call_optimization.is_simple_api_call()); | 237 DCHECK(call_optimization.is_simple_api_call()); |
| 238 if (FLAG_runtime_call_stats) { |
| 239 GenerateTailCall(masm(), slow_stub); |
| 240 } |
| 241 Register holder = Frontend(name); | 241 Register holder = Frontend(name); |
| 242 if (FLAG_runtime_call_stats) { | 242 GenerateApiAccessorCall(masm(), call_optimization, map(), receiver(), |
| 243 TailCallBuiltin(masm(), Builtins::kLoadIC_Slow); | 243 scratch2(), false, no_reg, holder, accessor_index); |
| 244 } else { | |
| 245 GenerateApiAccessorCall(masm(), call_optimization, map(), receiver(), | |
| 246 scratch2(), false, no_reg, holder, accessor_index); | |
| 247 } | |
| 248 return GetCode(kind(), name); | 244 return GetCode(kind(), name); |
| 249 } | 245 } |
| 250 | 246 |
| 251 | 247 |
| 252 void NamedLoadHandlerCompiler::InterceptorVectorSlotPush(Register holder_reg) { | 248 void NamedLoadHandlerCompiler::InterceptorVectorSlotPush(Register holder_reg) { |
| 253 if (IC::ICUseVector(kind())) { | 249 if (IC::ICUseVector(kind())) { |
| 254 if (holder_reg.is(receiver())) { | 250 if (holder_reg.is(receiver())) { |
| 255 PushVectorAndSlot(); | 251 PushVectorAndSlot(); |
| 256 } else { | 252 } else { |
| 257 DCHECK(holder_reg.is(scratch1())); | 253 DCHECK(holder_reg.is(scratch1())); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 Handle<Code> NamedStoreHandlerCompiler::CompileStoreViaSetter( | 552 Handle<Code> NamedStoreHandlerCompiler::CompileStoreViaSetter( |
| 557 Handle<JSObject> object, Handle<Name> name, int accessor_index, | 553 Handle<JSObject> object, Handle<Name> name, int accessor_index, |
| 558 int expected_arguments) { | 554 int expected_arguments) { |
| 559 Register holder = Frontend(name); | 555 Register holder = Frontend(name); |
| 560 GenerateStoreViaSetter(masm(), map(), receiver(), holder, accessor_index, | 556 GenerateStoreViaSetter(masm(), map(), receiver(), holder, accessor_index, |
| 561 expected_arguments, scratch2()); | 557 expected_arguments, scratch2()); |
| 562 | 558 |
| 563 return GetCode(kind(), name); | 559 return GetCode(kind(), name); |
| 564 } | 560 } |
| 565 | 561 |
| 566 | |
| 567 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 562 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
| 568 Handle<JSObject> object, Handle<Name> name, | 563 Handle<JSObject> object, Handle<Name> name, |
| 569 const CallOptimization& call_optimization, int accessor_index) { | 564 const CallOptimization& call_optimization, int accessor_index, |
| 565 Handle<Code> slow_stub) { |
| 566 if (FLAG_runtime_call_stats) { |
| 567 GenerateTailCall(masm(), slow_stub); |
| 568 } |
| 570 Register holder = Frontend(name); | 569 Register holder = Frontend(name); |
| 571 if (FLAG_runtime_call_stats) { | 570 GenerateApiAccessorCall(masm(), call_optimization, handle(object->map()), |
| 572 GenerateRestoreName(name); | 571 receiver(), scratch2(), true, value(), holder, |
| 573 TailCallBuiltin(masm(), Builtins::kStoreIC_Slow); | 572 accessor_index); |
| 574 } else { | |
| 575 GenerateApiAccessorCall(masm(), call_optimization, handle(object->map()), | |
| 576 receiver(), scratch2(), true, value(), holder, | |
| 577 accessor_index); | |
| 578 } | |
| 579 return GetCode(kind(), name); | 573 return GetCode(kind(), name); |
| 580 } | 574 } |
| 581 | 575 |
| 582 | 576 |
| 583 #undef __ | 577 #undef __ |
| 584 | 578 |
| 585 void ElementHandlerCompiler::CompileElementHandlers( | 579 void ElementHandlerCompiler::CompileElementHandlers( |
| 586 MapHandleList* receiver_maps, CodeHandleList* handlers) { | 580 MapHandleList* receiver_maps, CodeHandleList* handlers) { |
| 587 for (int i = 0; i < receiver_maps->length(); ++i) { | 581 for (int i = 0; i < receiver_maps->length(); ++i) { |
| 588 Handle<Map> receiver_map = receiver_maps->at(i); | 582 Handle<Map> receiver_map = receiver_maps->at(i); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 617 DCHECK(elements_kind == DICTIONARY_ELEMENTS); | 611 DCHECK(elements_kind == DICTIONARY_ELEMENTS); |
| 618 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); | 612 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); |
| 619 } | 613 } |
| 620 } | 614 } |
| 621 | 615 |
| 622 handlers->Add(cached_stub); | 616 handlers->Add(cached_stub); |
| 623 } | 617 } |
| 624 } | 618 } |
| 625 } // namespace internal | 619 } // namespace internal |
| 626 } // namespace v8 | 620 } // namespace v8 |
| OLD | NEW |