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
3 // found in the LICENSE file.
9 #include "src/ic/call-optimization.h"
10 #include "src/ic/handler-compiler.h"
11 #include "src/ic/ic.h"
16 #define __ ACCESS_MASM(masm)
19 void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
20 MacroAssembler* masm, Handle<HeapType> type, Register receiver,
21 Handle<JSFunction> getter) {
22 // ----------- S t a t e -------------
25 // -- lr : return address
26 // -----------------------------------
28 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
30 if (!getter.is_null()) {
31 // Call the JavaScript getter with the receiver on the stack.
32 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
33 // Swap in the global receiver.
35 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
38 ParameterCount actual(0);
39 ParameterCount expected(getter);
40 __ InvokeFunction(getter, expected, actual, CALL_FUNCTION,
43 // If we generate a global code snippet for deoptimization only, remember
44 // the place to continue after deoptimization.
45 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset());
48 // Restore context register.
49 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
55 void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
56 MacroAssembler* masm, Handle<HeapType> type, Register receiver,
57 Handle<JSFunction> setter) {
58 // ----------- S t a t e -------------
59 // -- lr : return address
60 // -----------------------------------
62 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
64 // Save value register, so we can restore it later.
67 if (!setter.is_null()) {
68 // Call the JavaScript setter with receiver and value on the stack.
69 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
70 // Swap in the global receiver.
72 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
74 __ Push(receiver, value());
75 ParameterCount actual(1);
76 ParameterCount expected(setter);
77 __ InvokeFunction(setter, expected, actual, CALL_FUNCTION,
80 // If we generate a global code snippet for deoptimization only, remember
81 // the place to continue after deoptimization.
82 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset());
85 // We have to return the passed value, not the return value of the setter.
88 // Restore context register.
89 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
95 void PropertyHandlerCompiler::PushVectorAndSlot(Register vector,
97 MacroAssembler* masm = this->masm();
103 void PropertyHandlerCompiler::PopVectorAndSlot(Register vector, Register slot) {
104 MacroAssembler* masm = this->masm();
110 void PropertyHandlerCompiler::DiscardVectorAndSlot() {
111 MacroAssembler* masm = this->masm();
112 // Remove vector and slot.
113 __ add(sp, sp, Operand(2 * kPointerSize));
117 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
118 MacroAssembler* masm, Label* miss_label, Register receiver,
119 Handle<Name> name, Register scratch0, Register scratch1) {
120 DCHECK(name->IsUniqueName());
121 DCHECK(!receiver.is(scratch0));
122 Counters* counters = masm->isolate()->counters();
123 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1);
124 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
128 const int kInterceptorOrAccessCheckNeededMask =
129 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded);
131 // Bail out if the receiver has a named interceptor or requires access checks.
132 Register map = scratch1;
133 __ ldr(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
134 __ ldrb(scratch0, FieldMemOperand(map, Map::kBitFieldOffset));
135 __ tst(scratch0, Operand(kInterceptorOrAccessCheckNeededMask));
136 __ b(ne, miss_label);
138 // Check that receiver is a JSObject.
139 __ ldrb(scratch0, FieldMemOperand(map, Map::kInstanceTypeOffset));
140 __ cmp(scratch0, Operand(FIRST_SPEC_OBJECT_TYPE));
141 __ b(lt, miss_label);
143 // Load properties array.
144 Register properties = scratch0;
145 __ ldr(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
146 // Check that the properties array is a dictionary.
147 __ ldr(map, FieldMemOperand(properties, HeapObject::kMapOffset));
148 Register tmp = properties;
149 __ LoadRoot(tmp, Heap::kHashTableMapRootIndex);
151 __ b(ne, miss_label);
153 // Restore the temporarily used register.
154 __ ldr(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
157 NameDictionaryLookupStub::GenerateNegativeLookup(
158 masm, miss_label, &done, receiver, properties, name, scratch1);
160 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
164 void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
165 MacroAssembler* masm, int index, Register result, Label* miss) {
166 const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX);
167 __ ldr(result, MemOperand(cp, offset));
168 __ ldr(result, FieldMemOperand(result, GlobalObject::kNativeContextOffset));
169 __ ldr(result, MemOperand(result, Context::SlotOffset(index)));
170 // Load its initial map. The global functions all have initial maps.
172 FieldMemOperand(result, JSFunction::kPrototypeOrInitialMapOffset));
173 // Load the prototype from the initial map.
174 __ ldr(result, FieldMemOperand(result, Map::kPrototypeOffset));
178 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(
179 MacroAssembler* masm, Register receiver, Register scratch1,
180 Register scratch2, Label* miss_label) {
181 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
182 __ mov(r0, scratch1);
187 // Generate code to check that a global property cell is empty. Create
188 // the property cell at compilation time if no cell exists for the
190 void PropertyHandlerCompiler::GenerateCheckPropertyCell(
191 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name,
192 Register scratch, Label* miss) {
193 Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
194 DCHECK(cell->value()->IsTheHole());
195 __ mov(scratch, Operand(cell));
196 __ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
197 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
203 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver,
204 Register holder, Register name,
205 Handle<JSObject> holder_obj) {
206 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0);
207 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsInfoIndex == 1);
208 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 2);
209 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 3);
210 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 4);
212 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor());
213 DCHECK(!masm->isolate()->heap()->InNewSpace(*interceptor));
214 Register scratch = name;
215 __ mov(scratch, Operand(interceptor));
222 static void CompileCallLoadPropertyWithInterceptor(
223 MacroAssembler* masm, Register receiver, Register holder, Register name,
224 Handle<JSObject> holder_obj, IC::UtilityId id) {
225 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
226 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()),
227 NamedLoadHandlerCompiler::kInterceptorArgsLength);
231 // Generate call to api function.
232 void PropertyHandlerCompiler::GenerateFastApiCall(
233 MacroAssembler* masm, const CallOptimization& optimization,
234 Handle<Map> receiver_map, Register receiver, Register scratch_in,
235 bool is_store, int argc, Register* values) {
236 DCHECK(!receiver.is(scratch_in));
238 // Write the arguments to stack frame.
239 for (int i = 0; i < argc; i++) {
240 Register arg = values[argc - 1 - i];
241 DCHECK(!receiver.is(arg));
242 DCHECK(!scratch_in.is(arg));
245 DCHECK(optimization.is_simple_api_call());
247 // Abi for CallApiFunctionStub.
248 Register callee = r0;
249 Register call_data = r4;
250 Register holder = r2;
251 Register api_function_address = r1;
253 // Put holder in place.
254 CallOptimization::HolderLookup holder_lookup;
255 Handle<JSObject> api_holder =
256 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup);
257 switch (holder_lookup) {
258 case CallOptimization::kHolderIsReceiver:
259 __ Move(holder, receiver);
261 case CallOptimization::kHolderFound:
262 __ Move(holder, api_holder);
264 case CallOptimization::kHolderNotFound:
269 Isolate* isolate = masm->isolate();
270 Handle<JSFunction> function = optimization.constant_function();
271 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
272 Handle<Object> call_data_obj(api_call_info->data(), isolate);
274 // Put callee in place.
275 __ Move(callee, function);
277 bool call_data_undefined = false;
278 // Put call_data in place.
279 if (isolate->heap()->InNewSpace(*call_data_obj)) {
280 __ Move(call_data, api_call_info);
281 __ ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset));
282 } else if (call_data_obj->IsUndefined()) {
283 call_data_undefined = true;
284 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
286 __ Move(call_data, call_data_obj);
289 // Put api_function_address in place.
290 Address function_address = v8::ToCData<Address>(api_call_info->callback());
291 ApiFunction fun(function_address);
292 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL;
293 ExternalReference ref = ExternalReference(&fun, type, masm->isolate());
294 __ mov(api_function_address, Operand(ref));
297 CallApiFunctionStub stub(isolate, is_store, call_data_undefined, argc);
298 __ TailCallStub(&stub);
302 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
303 // Push receiver, key and value for runtime call.
304 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
305 StoreDescriptor::ValueRegister());
307 // The slow case calls into the runtime to complete the store without causing
308 // an IC miss that would otherwise cause a transition to the generic stub.
309 ExternalReference ref =
310 ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate());
311 __ TailCallExternalReference(ref, 3, 1);
315 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
316 // Push receiver, key and value for runtime call.
317 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
318 StoreDescriptor::ValueRegister());
320 // The slow case calls into the runtime to complete the store without causing
321 // an IC miss that would otherwise cause a transition to the generic stub.
322 ExternalReference ref =
323 ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate());
324 __ TailCallExternalReference(ref, 3, 1);
329 #define __ ACCESS_MASM(masm())
332 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label,
334 if (!label->is_unused()) {
336 __ mov(this->name(), Operand(name));
341 void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) {
342 __ mov(this->name(), Operand(name));
346 void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition,
349 Handle<WeakCell> cell = Map::WeakCellForMap(transition);
350 Register map_reg = StoreTransitionDescriptor::MapRegister();
351 DCHECK(!map_reg.is(scratch));
352 __ LoadWeakValue(map_reg, cell, miss);
353 if (transition->CanBeDeprecated()) {
354 __ ldr(scratch, FieldMemOperand(map_reg, Map::kBitField3Offset));
355 __ tst(scratch, Operand(Map::Deprecated::kMask));
361 void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg,
366 DCHECK(!map_reg.is(scratch));
367 DCHECK(!map_reg.is(value_reg));
368 DCHECK(!value_reg.is(scratch));
369 __ LoadInstanceDescriptors(map_reg, scratch);
371 FieldMemOperand(scratch, DescriptorArray::GetValueOffset(descriptor)));
372 __ cmp(value_reg, scratch);
373 __ b(ne, miss_label);
377 void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type,
380 __ JumpIfSmi(value_reg, miss_label);
381 HeapType::Iterator<Map> it = field_type->Classes();
383 __ ldr(scratch1(), FieldMemOperand(value_reg, HeapObject::kMapOffset));
386 __ CompareMap(scratch1(), it.Current(), &do_store);
389 __ b(ne, miss_label);
399 Register PropertyHandlerCompiler::CheckPrototypes(
400 Register object_reg, Register holder_reg, Register scratch1,
401 Register scratch2, Handle<Name> name, Label* miss,
402 PrototypeCheckType check) {
403 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate()));
405 // Make sure there's no overlap between holder and object registers.
406 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
407 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) &&
408 !scratch2.is(scratch1));
410 // Keep track of the current object in register reg.
411 Register reg = object_reg;
414 Handle<JSObject> current = Handle<JSObject>::null();
415 if (type()->IsConstant()) {
416 current = Handle<JSObject>::cast(type()->AsConstant()->Value());
418 Handle<JSObject> prototype = Handle<JSObject>::null();
419 Handle<Map> current_map = receiver_map;
420 Handle<Map> holder_map(holder()->map());
421 // Traverse the prototype chain and check the maps in the prototype chain for
422 // fast and global objects or do negative lookup for normal objects.
423 while (!current_map.is_identical_to(holder_map)) {
426 // Only global objects and objects that do not require access
427 // checks are allowed in stubs.
428 DCHECK(current_map->IsJSGlobalProxyMap() ||
429 !current_map->is_access_check_needed());
431 prototype = handle(JSObject::cast(current_map->prototype()));
432 if (current_map->is_dictionary_map() &&
433 !current_map->IsJSGlobalObjectMap()) {
434 DCHECK(!current_map->IsJSGlobalProxyMap()); // Proxy maps are fast.
435 if (!name->IsUniqueName()) {
436 DCHECK(name->IsString());
437 name = factory()->InternalizeString(Handle<String>::cast(name));
439 DCHECK(current.is_null() ||
440 current->property_dictionary()->FindEntry(name) ==
441 NameDictionary::kNotFound);
443 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1,
446 __ ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
447 reg = holder_reg; // From now on the object will be in holder_reg.
448 __ ldr(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset));
450 Register map_reg = scratch1;
451 __ ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
452 if (depth != 1 || check == CHECK_ALL_MAPS) {
453 Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
454 __ CmpWeakValue(map_reg, cell, scratch2);
458 // Check access rights to the global object. This has to happen after
459 // the map check so that we know that the object is actually a global
461 // This allows us to install generated handlers for accesses to the
462 // global proxy (as opposed to using slow ICs). See corresponding code
463 // in LookupForRead().
464 if (current_map->IsJSGlobalProxyMap()) {
465 __ CheckAccessGlobalProxy(reg, scratch2, miss);
466 } else if (current_map->IsJSGlobalObjectMap()) {
467 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current),
468 name, scratch2, miss);
471 reg = holder_reg; // From now on the object will be in holder_reg.
473 __ ldr(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset));
476 // Go to the next object in the prototype chain.
478 current_map = handle(current->map());
481 // Log the check depth.
482 LOG(isolate(), IntEvent("check-maps-depth", depth + 1));
484 if (depth != 0 || check == CHECK_ALL_MAPS) {
485 // Check the holder map.
486 __ ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
487 Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
488 __ CmpWeakValue(scratch1, cell, scratch2);
492 // Perform security check for access to the global object.
493 DCHECK(current_map->IsJSGlobalProxyMap() ||
494 !current_map->is_access_check_needed());
495 if (current_map->IsJSGlobalProxyMap()) {
496 __ CheckAccessGlobalProxy(reg, scratch1, miss);
499 // Return the register containing the holder.
504 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
505 if (!miss->is_unused()) {
509 if (IC::ICUseVector(kind())) {
510 DCHECK(kind() == Code::LOAD_IC);
513 TailCallBuiltin(masm(), MissBuiltin(kind()));
519 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
520 if (!miss->is_unused()) {
523 GenerateRestoreName(miss, name);
524 TailCallBuiltin(masm(), MissBuiltin(kind()));
530 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
531 // Return the constant value.
537 void NamedLoadHandlerCompiler::GenerateLoadCallback(
538 Register reg, Handle<ExecutableAccessorInfo> callback) {
539 // Build AccessorInfo::args_ list on the stack and push property name below
540 // the exit frame to make GC aware of them and store pointers to them.
541 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0);
542 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1);
543 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2);
544 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3);
545 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4);
546 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
547 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6);
548 DCHECK(!scratch2().is(reg));
549 DCHECK(!scratch3().is(reg));
550 DCHECK(!scratch4().is(reg));
552 if (heap()->InNewSpace(callback->data())) {
553 __ Move(scratch3(), callback);
555 FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset));
557 __ Move(scratch3(), Handle<Object>(callback->data(), isolate()));
560 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex);
561 __ mov(scratch4(), scratch3());
562 __ Push(scratch3(), scratch4());
563 __ mov(scratch4(), Operand(ExternalReference::isolate_address(isolate())));
564 __ Push(scratch4(), reg);
565 __ mov(scratch2(), sp); // scratch2 = PropertyAccessorInfo::args_
568 // Abi for CallApiGetter
569 Register getter_address_reg = ApiGetterDescriptor::function_address();
571 Address getter_address = v8::ToCData<Address>(callback->getter());
572 ApiFunction fun(getter_address);
573 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL;
574 ExternalReference ref = ExternalReference(&fun, type, isolate());
575 __ mov(getter_address_reg, Operand(ref));
577 CallApiGetterStub stub(isolate());
578 __ TailCallStub(&stub);
582 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
583 LookupIterator* it, Register holder_reg) {
584 DCHECK(holder()->HasNamedInterceptor());
585 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
587 // Compile the interceptor call, followed by inline code to load the
588 // property from further up the prototype chain if the call fails.
589 // Check that the maps haven't changed.
590 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1()));
592 // Preserve the receiver register explicitly whenever it is different from the
593 // holder and it is needed should the interceptor return without any result.
594 // The ACCESSOR case needs the receiver to be passed into C++ code, the FIELD
595 // case might cause a miss during the prototype check.
596 bool must_perform_prototype_check =
597 !holder().is_identical_to(it->GetHolder<JSObject>());
598 bool must_preserve_receiver_reg =
599 !receiver().is(holder_reg) &&
600 (it->state() == LookupIterator::ACCESSOR || must_perform_prototype_check);
602 // Save necessary data before invoking an interceptor.
603 // Requires a frame to make GC aware of pushed pointers.
605 FrameAndConstantPoolScope frame_scope(masm(), StackFrame::INTERNAL);
606 if (must_preserve_receiver_reg) {
607 __ Push(receiver(), holder_reg, this->name());
609 __ Push(holder_reg, this->name());
611 InterceptorVectorSlotPush(holder_reg);
612 // Invoke an interceptor. Note: map checks from receiver to
613 // interceptor's holder has been compiled before (see a caller
615 CompileCallLoadPropertyWithInterceptor(
616 masm(), receiver(), holder_reg, this->name(), holder(),
617 IC::kLoadPropertyWithInterceptorOnly);
619 // Check if interceptor provided a value for property. If it's
620 // the case, return immediately.
621 Label interceptor_failed;
622 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex);
623 __ cmp(r0, scratch1());
624 __ b(eq, &interceptor_failed);
625 frame_scope.GenerateLeaveFrame();
628 __ bind(&interceptor_failed);
629 InterceptorVectorSlotPop(holder_reg);
630 __ pop(this->name());
632 if (must_preserve_receiver_reg) {
635 // Leave the internal frame.
638 GenerateLoadPostInterceptor(it, holder_reg);
642 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
643 // Call the runtime system to load the interceptor.
644 DCHECK(holder()->HasNamedInterceptor());
645 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
646 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(),
649 ExternalReference ref = ExternalReference(
650 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate());
651 __ TailCallExternalReference(
652 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
656 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
657 Handle<JSObject> object, Handle<Name> name,
658 Handle<ExecutableAccessorInfo> callback) {
659 Register holder_reg = Frontend(name);
661 __ push(receiver()); // receiver
663 __ mov(ip, Operand(callback)); // callback info
665 __ mov(ip, Operand(name));
666 __ Push(ip, value());
668 // Do tail-call to the runtime system.
669 ExternalReference store_callback_property =
670 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
671 __ TailCallExternalReference(store_callback_property, 5, 1);
673 // Return the generated code.
674 return GetCode(kind(), Code::FAST, name);
678 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
680 __ Push(receiver(), this->name(), value());
682 // Do tail-call to the runtime system.
683 ExternalReference store_ic_property = ExternalReference(
684 IC_Utility(IC::kStorePropertyWithInterceptor), isolate());
685 __ TailCallExternalReference(store_ic_property, 3, 1);
687 // Return the generated code.
688 return GetCode(kind(), Code::FAST, name);
692 Register NamedStoreHandlerCompiler::value() {
693 return StoreDescriptor::ValueRegister();
697 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
698 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) {
700 if (IC::ICUseVector(kind())) {
703 FrontendHeader(receiver(), name, &miss);
705 // Get the value from the cell.
706 Register result = StoreDescriptor::ValueRegister();
707 Handle<WeakCell> weak_cell = factory()->NewWeakCell(cell);
708 __ LoadWeakValue(result, weak_cell, &miss);
709 __ ldr(result, FieldMemOperand(result, Cell::kValueOffset));
711 // Check for deleted property if property can actually be deleted.
712 if (is_configurable) {
713 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
718 Counters* counters = isolate()->counters();
719 __ IncrementCounter(counters->named_load_global_stub(), 1, r1, r3);
720 if (IC::ICUseVector(kind())) {
721 DiscardVectorAndSlot();
725 FrontendFooter(name, &miss);
727 // Return the generated code.
728 return GetCode(kind(), Code::NORMAL, name);
734 } // namespace v8::internal
736 #endif // V8_TARGET_ARCH_ARM