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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 __ JumpIfNotRoot(map, Heap::kHashTableMapRootIndex, miss_label); | 50 __ JumpIfNotRoot(map, Heap::kHashTableMapRootIndex, miss_label); |
51 | 51 |
52 NameDictionaryLookupStub::GenerateNegativeLookup( | 52 NameDictionaryLookupStub::GenerateNegativeLookup( |
53 masm, miss_label, &done, receiver, properties, name, scratch1); | 53 masm, miss_label, &done, receiver, properties, name, scratch1); |
54 __ Bind(&done); | 54 __ Bind(&done); |
55 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); | 55 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); |
56 } | 56 } |
57 | 57 |
58 | 58 |
59 void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( | 59 void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( |
60 MacroAssembler* masm, int index, Register prototype, Label* miss) { | 60 MacroAssembler* masm, int index, Register prototype, Register scratch, |
61 Label* miss) { | |
61 Isolate* isolate = masm->isolate(); | 62 Isolate* isolate = masm->isolate(); |
62 // Get the global function with the given index. | 63 // Get the global function with the given index. |
63 Handle<JSFunction> function( | 64 Handle<JSFunction> jsfunction( |
64 JSFunction::cast(isolate->native_context()->get(index))); | 65 JSFunction::cast(isolate->native_context()->get(index))); |
66 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(jsfunction); | |
65 | 67 |
66 // Check we're still in the same context. | 68 // Check we're still in the same context. |
67 Register scratch = prototype; | 69 Register function = prototype; |
68 __ Ldr(scratch, GlobalObjectMemOperand()); | 70 __ Ldr(scratch, GlobalObjectMemOperand()); |
69 __ Ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | 71 __ Ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); |
70 __ Ldr(scratch, ContextMemOperand(scratch, index)); | 72 __ Ldr(function, ContextMemOperand(scratch, index)); |
71 __ Cmp(scratch, Operand(function)); | 73 __ CmpWeakValue(function, cell, scratch); |
Toon Verwaest
2014/12/03 16:22:09
Why still embed the weak cell if all you do is mis
| |
72 __ B(ne, miss); | 74 __ B(ne, miss); |
73 | 75 |
74 // Load its initial map. The global functions all have initial maps. | 76 // Load its initial map. The global functions all have initial maps. |
75 __ Mov(prototype, Operand(Handle<Map>(function->initial_map()))); | 77 __ Ldr(scratch, |
78 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | |
76 // Load the prototype from the initial map. | 79 // Load the prototype from the initial map. |
77 __ Ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); | 80 __ Ldr(prototype, FieldMemOperand(scratch, Map::kPrototypeOffset)); |
78 } | 81 } |
79 | 82 |
80 | 83 |
81 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( | 84 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( |
82 MacroAssembler* masm, Register receiver, Register scratch1, | 85 MacroAssembler* masm, Register receiver, Register scratch1, |
83 Register scratch2, Label* miss_label) { | 86 Register scratch2, Label* miss_label) { |
84 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 87 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
85 // TryGetFunctionPrototype can't put the result directly in x0 because the | 88 // TryGetFunctionPrototype can't put the result directly in x0 because the |
86 // 3 inputs registers can't alias and we call this function from | 89 // 3 inputs registers can't alias and we call this function from |
87 // LoadIC::GenerateFunctionPrototype, where receiver is x0. So we explicitly | 90 // LoadIC::GenerateFunctionPrototype, where receiver is x0. So we explicitly |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
698 // Return the generated code. | 701 // Return the generated code. |
699 return GetCode(kind(), Code::FAST, name); | 702 return GetCode(kind(), Code::FAST, name); |
700 } | 703 } |
701 | 704 |
702 | 705 |
703 #undef __ | 706 #undef __ |
704 } | 707 } |
705 } // namespace v8::internal | 708 } // namespace v8::internal |
706 | 709 |
707 #endif // V8_TARGET_ARCH_IA32 | 710 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |