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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
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 // -- a0 : receiver | 23 // -- a0 : receiver |
25 // -- a2 : name | 24 // -- a2 : name |
26 // -- ra : return address | 25 // -- ra : return address |
27 // ----------------------------------- | 26 // ----------------------------------- |
28 { | 27 { |
29 FrameScope scope(masm, StackFrame::INTERNAL); | 28 FrameScope 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 __ ld(scratch, | 36 __ ld(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(a1, holder, accessor_index, ACCESSOR_GETTER); | 43 __ LoadAccessor(a1, holder, accessor_index, ACCESSOR_GETTER); |
45 __ InvokeFunction(a1, expected, actual, CALL_FUNCTION, NullCallWrapper()); | 44 __ InvokeFunction(a1, 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 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 52 __ ld(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 // -- ra : return address | 62 // -- ra : return address |
65 // ----------------------------------- | 63 // ----------------------------------- |
66 { | 64 { |
67 FrameScope scope(masm, StackFrame::INTERNAL); | 65 FrameScope 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 __ ld(scratch, | 77 __ ld(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(a1, holder, accessor_index, ACCESSOR_SETTER); | 84 __ LoadAccessor(a1, holder, accessor_index, ACCESSOR_SETTER); |
87 __ InvokeFunction(a1, expected, actual, CALL_FUNCTION, NullCallWrapper()); | 85 __ InvokeFunction(a1, expected, actual, CALL_FUNCTION, NullCallWrapper()); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 } | 397 } |
400 __ bind(&do_store); | 398 __ bind(&do_store); |
401 } | 399 } |
402 } | 400 } |
403 | 401 |
404 | 402 |
405 Register PropertyHandlerCompiler::CheckPrototypes( | 403 Register PropertyHandlerCompiler::CheckPrototypes( |
406 Register object_reg, Register holder_reg, Register scratch1, | 404 Register object_reg, Register holder_reg, Register scratch1, |
407 Register scratch2, Handle<Name> name, Label* miss, | 405 Register scratch2, Handle<Name> name, Label* miss, |
408 PrototypeCheckType check) { | 406 PrototypeCheckType check) { |
409 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); | 407 Handle<Map> receiver_map = map(); |
410 | 408 |
411 // Make sure there's no overlap between holder and object registers. | 409 // Make sure there's no overlap between holder and object registers. |
412 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); | 410 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); |
413 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) && | 411 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) && |
414 !scratch2.is(scratch1)); | 412 !scratch2.is(scratch1)); |
415 | 413 |
416 // Keep track of the current object in register reg. | 414 // Keep track of the current object in register reg. |
417 Register reg = object_reg; | 415 Register reg = object_reg; |
418 int depth = 0; | 416 int depth = 0; |
419 | 417 |
420 Handle<JSObject> current = Handle<JSObject>::null(); | 418 Handle<JSObject> current = Handle<JSObject>::null(); |
421 if (type()->IsConstant()) { | 419 if (receiver_map->IsJSGlobalObjectMap()) { |
422 current = Handle<JSObject>::cast(type()->AsConstant()->Value()); | 420 current = isolate()->global_object(); |
423 } | 421 } |
424 Handle<JSObject> prototype = Handle<JSObject>::null(); | 422 Handle<JSObject> prototype = Handle<JSObject>::null(); |
425 Handle<Map> current_map = receiver_map; | 423 Handle<Map> current_map = receiver_map; |
426 Handle<Map> holder_map(holder()->map()); | 424 Handle<Map> holder_map(holder()->map()); |
427 // Traverse the prototype chain and check the maps in the prototype chain for | 425 // Traverse the prototype chain and check the maps in the prototype chain for |
428 // fast and global objects or do negative lookup for normal objects. | 426 // fast and global objects or do negative lookup for normal objects. |
429 while (!current_map.is_identical_to(holder_map)) { | 427 while (!current_map.is_identical_to(holder_map)) { |
430 ++depth; | 428 ++depth; |
431 | 429 |
432 // Only global objects and objects that do not require access | 430 // Only global objects and objects that do not require access |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 // Return the generated code. | 735 // Return the generated code. |
738 return GetCode(kind(), Code::NORMAL, name); | 736 return GetCode(kind(), Code::NORMAL, name); |
739 } | 737 } |
740 | 738 |
741 | 739 |
742 #undef __ | 740 #undef __ |
743 } | 741 } |
744 } // namespace v8::internal | 742 } // namespace v8::internal |
745 | 743 |
746 #endif // V8_TARGET_ARCH_MIPS64 | 744 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |