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_PPC | 7 #if V8_TARGET_ARCH_PPC |
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 // -- r3 : receiver | 23 // -- r3 : receiver |
25 // -- r5 : name | 24 // -- r5 : 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 __ LoadP(scratch, | 36 __ LoadP(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(r4, holder, accessor_index, ACCESSOR_GETTER); | 43 __ LoadAccessor(r4, holder, accessor_index, ACCESSOR_GETTER); |
45 __ InvokeFunction(r4, expected, actual, CALL_FUNCTION, NullCallWrapper()); | 44 __ InvokeFunction(r4, 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 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 52 __ LoadP(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 __ LoadP(scratch, | 77 __ LoadP(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(r4, holder, accessor_index, ACCESSOR_SETTER); | 84 __ LoadAccessor(r4, holder, accessor_index, ACCESSOR_SETTER); |
87 __ InvokeFunction(r4, expected, actual, CALL_FUNCTION, NullCallWrapper()); | 85 __ InvokeFunction(r4, expected, actual, CALL_FUNCTION, NullCallWrapper()); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 } | 405 } |
408 __ bind(&do_store); | 406 __ bind(&do_store); |
409 } | 407 } |
410 } | 408 } |
411 | 409 |
412 | 410 |
413 Register PropertyHandlerCompiler::CheckPrototypes( | 411 Register PropertyHandlerCompiler::CheckPrototypes( |
414 Register object_reg, Register holder_reg, Register scratch1, | 412 Register object_reg, Register holder_reg, Register scratch1, |
415 Register scratch2, Handle<Name> name, Label* miss, | 413 Register scratch2, Handle<Name> name, Label* miss, |
416 PrototypeCheckType check) { | 414 PrototypeCheckType check) { |
417 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); | 415 Handle<Map> receiver_map = map(); |
418 | 416 |
419 // Make sure there's no overlap between holder and object registers. | 417 // Make sure there's no overlap between holder and object registers. |
420 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); | 418 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); |
421 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) && | 419 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) && |
422 !scratch2.is(scratch1)); | 420 !scratch2.is(scratch1)); |
423 | 421 |
424 // Keep track of the current object in register reg. | 422 // Keep track of the current object in register reg. |
425 Register reg = object_reg; | 423 Register reg = object_reg; |
426 int depth = 0; | 424 int depth = 0; |
427 | 425 |
428 Handle<JSObject> current = Handle<JSObject>::null(); | 426 Handle<JSObject> current = Handle<JSObject>::null(); |
429 if (type()->IsConstant()) { | 427 if (receiver_map->IsJSGlobalObjectMap()) { |
430 current = Handle<JSObject>::cast(type()->AsConstant()->Value()); | 428 current = isolate()->global_object(); |
431 } | 429 } |
432 Handle<JSObject> prototype = Handle<JSObject>::null(); | 430 Handle<JSObject> prototype = Handle<JSObject>::null(); |
433 Handle<Map> current_map = receiver_map; | 431 Handle<Map> current_map = receiver_map; |
434 Handle<Map> holder_map(holder()->map()); | 432 Handle<Map> holder_map(holder()->map()); |
435 // Traverse the prototype chain and check the maps in the prototype chain for | 433 // Traverse the prototype chain and check the maps in the prototype chain for |
436 // fast and global objects or do negative lookup for normal objects. | 434 // fast and global objects or do negative lookup for normal objects. |
437 while (!current_map.is_identical_to(holder_map)) { | 435 while (!current_map.is_identical_to(holder_map)) { |
438 ++depth; | 436 ++depth; |
439 | 437 |
440 // Only global objects and objects that do not require access | 438 // Only global objects and objects that do not require access |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 // Return the generated code. | 740 // Return the generated code. |
743 return GetCode(kind(), Code::NORMAL, name); | 741 return GetCode(kind(), Code::NORMAL, name); |
744 } | 742 } |
745 | 743 |
746 | 744 |
747 #undef __ | 745 #undef __ |
748 } | 746 } |
749 } // namespace v8::internal | 747 } // namespace v8::internal |
750 | 748 |
751 #endif // V8_TARGET_ARCH_ARM | 749 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |