| 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 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
| 8 | 8 |
| 9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
| 10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
| 11 #include "src/ic/ic.h" | 11 #include "src/ic/ic.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 #define __ ACCESS_MASM(masm) | 16 #define __ ACCESS_MASM(masm) |
| 17 | 17 |
| 18 | 18 |
| 19 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( | 19 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( |
| 20 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 20 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, |
| 21 Register holder, int accessor_index, int expected_arguments, | 21 int accessor_index, int expected_arguments, Register scratch) { |
| 22 Register scratch) { | |
| 23 // ----------- S t a t e ------------- | 22 // ----------- S t a t e ------------- |
| 24 // -- r0 : receiver | 23 // -- r0 : receiver |
| 25 // -- r2 : name | 24 // -- r2 : name |
| 26 // -- lr : return address | 25 // -- lr : return address |
| 27 // ----------------------------------- | 26 // ----------------------------------- |
| 28 { | 27 { |
| 29 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 28 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 30 | 29 |
| 31 if (accessor_index >= 0) { | 30 if (accessor_index >= 0) { |
| 32 DCHECK(!holder.is(scratch)); | 31 DCHECK(!holder.is(scratch)); |
| 33 DCHECK(!receiver.is(scratch)); | 32 DCHECK(!receiver.is(scratch)); |
| 34 // Call the JavaScript getter with the receiver on the stack. | 33 // Call the JavaScript getter with the receiver on the stack. |
| 35 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 34 if (map->IsJSGlobalObjectMap()) { |
| 36 // Swap in the global receiver. | 35 // Swap in the global receiver. |
| 37 __ ldr(scratch, | 36 __ ldr(scratch, |
| 38 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 37 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 39 receiver = scratch; | 38 receiver = scratch; |
| 40 } | 39 } |
| 41 __ push(receiver); | 40 __ push(receiver); |
| 42 ParameterCount actual(0); | 41 ParameterCount actual(0); |
| 43 ParameterCount expected(expected_arguments); | 42 ParameterCount expected(expected_arguments); |
| 44 __ LoadAccessor(r1, holder, accessor_index, ACCESSOR_GETTER); | 43 __ LoadAccessor(r1, holder, accessor_index, ACCESSOR_GETTER); |
| 45 __ InvokeFunction(r1, expected, actual, CALL_FUNCTION, NullCallWrapper()); | 44 __ InvokeFunction(r1, expected, actual, CALL_FUNCTION, NullCallWrapper()); |
| 46 } else { | 45 } else { |
| 47 // If we generate a global code snippet for deoptimization only, remember | 46 // If we generate a global code snippet for deoptimization only, remember |
| 48 // the place to continue after deoptimization. | 47 // the place to continue after deoptimization. |
| 49 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 48 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
| 50 } | 49 } |
| 51 | 50 |
| 52 // Restore context register. | 51 // Restore context register. |
| 53 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 52 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 54 } | 53 } |
| 55 __ Ret(); | 54 __ Ret(); |
| 56 } | 55 } |
| 57 | 56 |
| 58 | 57 |
| 59 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( | 58 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
| 60 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 59 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, |
| 61 Register holder, int accessor_index, int expected_arguments, | 60 int accessor_index, int expected_arguments, Register scratch) { |
| 62 Register scratch) { | |
| 63 // ----------- S t a t e ------------- | 61 // ----------- S t a t e ------------- |
| 64 // -- lr : return address | 62 // -- lr : return address |
| 65 // ----------------------------------- | 63 // ----------------------------------- |
| 66 { | 64 { |
| 67 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 65 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 68 | 66 |
| 69 // Save value register, so we can restore it later. | 67 // Save value register, so we can restore it later. |
| 70 __ push(value()); | 68 __ push(value()); |
| 71 | 69 |
| 72 if (accessor_index >= 0) { | 70 if (accessor_index >= 0) { |
| 73 DCHECK(!holder.is(scratch)); | 71 DCHECK(!holder.is(scratch)); |
| 74 DCHECK(!receiver.is(scratch)); | 72 DCHECK(!receiver.is(scratch)); |
| 75 DCHECK(!value().is(scratch)); | 73 DCHECK(!value().is(scratch)); |
| 76 // Call the JavaScript setter with receiver and value on the stack. | 74 // Call the JavaScript setter with receiver and value on the stack. |
| 77 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 75 if (map->IsJSGlobalObjectMap()) { |
| 78 // Swap in the global receiver. | 76 // Swap in the global receiver. |
| 79 __ ldr(scratch, | 77 __ ldr(scratch, |
| 80 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 78 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 81 receiver = scratch; | 79 receiver = scratch; |
| 82 } | 80 } |
| 83 __ Push(receiver, value()); | 81 __ Push(receiver, value()); |
| 84 ParameterCount actual(1); | 82 ParameterCount actual(1); |
| 85 ParameterCount expected(expected_arguments); | 83 ParameterCount expected(expected_arguments); |
| 86 __ LoadAccessor(r1, holder, accessor_index, ACCESSOR_SETTER); | 84 __ LoadAccessor(r1, holder, accessor_index, ACCESSOR_SETTER); |
| 87 __ InvokeFunction(r1, expected, actual, CALL_FUNCTION, NullCallWrapper()); | 85 __ InvokeFunction(r1, expected, actual, CALL_FUNCTION, NullCallWrapper()); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 } | 406 } |
| 409 __ bind(&do_store); | 407 __ bind(&do_store); |
| 410 } | 408 } |
| 411 } | 409 } |
| 412 | 410 |
| 413 | 411 |
| 414 Register PropertyHandlerCompiler::CheckPrototypes( | 412 Register PropertyHandlerCompiler::CheckPrototypes( |
| 415 Register object_reg, Register holder_reg, Register scratch1, | 413 Register object_reg, Register holder_reg, Register scratch1, |
| 416 Register scratch2, Handle<Name> name, Label* miss, | 414 Register scratch2, Handle<Name> name, Label* miss, |
| 417 PrototypeCheckType check) { | 415 PrototypeCheckType check) { |
| 418 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); | 416 Handle<Map> receiver_map = map(); |
| 419 | 417 |
| 420 // Make sure there's no overlap between holder and object registers. | 418 // Make sure there's no overlap between holder and object registers. |
| 421 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); | 419 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); |
| 422 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) && | 420 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) && |
| 423 !scratch2.is(scratch1)); | 421 !scratch2.is(scratch1)); |
| 424 | 422 |
| 425 // Keep track of the current object in register reg. | 423 // Keep track of the current object in register reg. |
| 426 Register reg = object_reg; | 424 Register reg = object_reg; |
| 427 int depth = 0; | 425 int depth = 0; |
| 428 | 426 |
| 429 Handle<JSObject> current = Handle<JSObject>::null(); | 427 Handle<JSObject> current = Handle<JSObject>::null(); |
| 430 if (type()->IsConstant()) { | 428 if (receiver_map->IsJSGlobalObjectMap()) { |
| 431 current = Handle<JSObject>::cast(type()->AsConstant()->Value()); | 429 current = isolate()->global_object(); |
| 432 } | 430 } |
| 433 Handle<JSObject> prototype = Handle<JSObject>::null(); | 431 Handle<JSObject> prototype = Handle<JSObject>::null(); |
| 434 Handle<Map> current_map = receiver_map; | 432 Handle<Map> current_map = receiver_map; |
| 435 Handle<Map> holder_map(holder()->map()); | 433 Handle<Map> holder_map(holder()->map()); |
| 436 // Traverse the prototype chain and check the maps in the prototype chain for | 434 // Traverse the prototype chain and check the maps in the prototype chain for |
| 437 // fast and global objects or do negative lookup for normal objects. | 435 // fast and global objects or do negative lookup for normal objects. |
| 438 while (!current_map.is_identical_to(holder_map)) { | 436 while (!current_map.is_identical_to(holder_map)) { |
| 439 ++depth; | 437 ++depth; |
| 440 | 438 |
| 441 // Only global objects and objects that do not require access | 439 // Only global objects and objects that do not require access |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 // Return the generated code. | 743 // Return the generated code. |
| 746 return GetCode(kind(), Code::NORMAL, name); | 744 return GetCode(kind(), Code::NORMAL, name); |
| 747 } | 745 } |
| 748 | 746 |
| 749 | 747 |
| 750 #undef __ | 748 #undef __ |
| 751 } | 749 } |
| 752 } // namespace v8::internal | 750 } // namespace v8::internal |
| 753 | 751 |
| 754 #endif // V8_TARGET_ARCH_ARM | 752 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |