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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 Label done; | 50 Label done; |
51 NameDictionaryLookupStub::GenerateNegativeLookup(masm, miss_label, &done, | 51 NameDictionaryLookupStub::GenerateNegativeLookup(masm, miss_label, &done, |
52 properties, name, scratch1); | 52 properties, name, scratch1); |
53 __ bind(&done); | 53 __ bind(&done); |
54 __ DecrementCounter(counters->negative_lookups_miss(), 1); | 54 __ DecrementCounter(counters->negative_lookups_miss(), 1); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( | 58 void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( |
59 MacroAssembler* masm, int index, Register prototype, Label* miss) { | 59 MacroAssembler* masm, int index, Register prototype, Register scratch, |
| 60 Label* miss) { |
60 Isolate* isolate = masm->isolate(); | 61 Isolate* isolate = masm->isolate(); |
61 // Get the global function with the given index. | 62 // Get the global function with the given index. |
62 Handle<JSFunction> function( | 63 Handle<JSFunction> jsfunction( |
63 JSFunction::cast(isolate->native_context()->get(index))); | 64 JSFunction::cast(isolate->native_context()->get(index))); |
64 | 65 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(jsfunction); |
65 // Check we're still in the same context. | 66 // Check we're still in the same context. |
66 Register scratch = prototype; | 67 Register function = prototype; |
67 const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); | 68 const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); |
68 __ movp(scratch, Operand(rsi, offset)); | 69 __ movp(scratch, Operand(rsi, offset)); |
69 __ movp(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); | 70 __ movp(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); |
70 __ Cmp(Operand(scratch, Context::SlotOffset(index)), function); | 71 __ movp(function, Operand(scratch, Context::SlotOffset(index))); |
| 72 __ CmpWeakValue(function, cell, scratch); |
71 __ j(not_equal, miss); | 73 __ j(not_equal, miss); |
72 | |
73 // Load its initial map. The global functions all have initial maps. | 74 // Load its initial map. The global functions all have initial maps. |
74 __ Move(prototype, Handle<Map>(function->initial_map())); | 75 __ movp(scratch, |
| 76 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
75 // Load the prototype from the initial map. | 77 // Load the prototype from the initial map. |
76 __ movp(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); | 78 __ movp(prototype, FieldOperand(scratch, Map::kPrototypeOffset)); |
77 } | 79 } |
78 | 80 |
79 | 81 |
80 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( | 82 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( |
81 MacroAssembler* masm, Register receiver, Register result, Register scratch, | 83 MacroAssembler* masm, Register receiver, Register result, Register scratch, |
82 Label* miss_label) { | 84 Label* miss_label) { |
83 __ TryGetFunctionPrototype(receiver, result, miss_label); | 85 __ TryGetFunctionPrototype(receiver, result, miss_label); |
84 if (!result.is(rax)) __ movp(rax, result); | 86 if (!result.is(rax)) __ movp(rax, result); |
85 __ ret(0); | 87 __ ret(0); |
86 } | 88 } |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 // Return the generated code. | 691 // Return the generated code. |
690 return GetCode(kind(), Code::NORMAL, name); | 692 return GetCode(kind(), Code::NORMAL, name); |
691 } | 693 } |
692 | 694 |
693 | 695 |
694 #undef __ | 696 #undef __ |
695 } | 697 } |
696 } // namespace v8::internal | 698 } // namespace v8::internal |
697 | 699 |
698 #endif // V8_TARGET_ARCH_X64 | 700 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |