| 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 result, Label* miss) { |
| 60 Isolate* isolate = masm->isolate(); | |
| 61 // Get the global function with the given index. | |
| 62 Handle<JSFunction> function( | |
| 63 JSFunction::cast(isolate->native_context()->get(index))); | |
| 64 | |
| 65 // Check we're still in the same context. | |
| 66 Register scratch = prototype; | |
| 67 const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); | 60 const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); |
| 68 __ movp(scratch, Operand(rsi, offset)); | 61 __ movp(result, Operand(rsi, offset)); |
| 69 __ movp(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); | 62 __ movp(result, FieldOperand(result, GlobalObject::kNativeContextOffset)); |
| 70 __ Cmp(Operand(scratch, Context::SlotOffset(index)), function); | 63 __ movp(result, Operand(result, Context::SlotOffset(index))); |
| 71 __ j(not_equal, miss); | |
| 72 | |
| 73 // Load its initial map. The global functions all have initial maps. | 64 // Load its initial map. The global functions all have initial maps. |
| 74 __ Move(prototype, Handle<Map>(function->initial_map())); | 65 __ movp(result, |
| 66 FieldOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); |
| 75 // Load the prototype from the initial map. | 67 // Load the prototype from the initial map. |
| 76 __ movp(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); | 68 __ movp(result, FieldOperand(result, Map::kPrototypeOffset)); |
| 77 } | 69 } |
| 78 | 70 |
| 79 | 71 |
| 80 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( | 72 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( |
| 81 MacroAssembler* masm, Register receiver, Register result, Register scratch, | 73 MacroAssembler* masm, Register receiver, Register result, Register scratch, |
| 82 Label* miss_label) { | 74 Label* miss_label) { |
| 83 __ TryGetFunctionPrototype(receiver, result, miss_label); | 75 __ TryGetFunctionPrototype(receiver, result, miss_label); |
| 84 if (!result.is(rax)) __ movp(rax, result); | 76 if (!result.is(rax)) __ movp(rax, result); |
| 85 __ ret(0); | 77 __ ret(0); |
| 86 } | 78 } |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 // Return the generated code. | 681 // Return the generated code. |
| 690 return GetCode(kind(), Code::NORMAL, name); | 682 return GetCode(kind(), Code::NORMAL, name); |
| 691 } | 683 } |
| 692 | 684 |
| 693 | 685 |
| 694 #undef __ | 686 #undef __ |
| 695 } | 687 } |
| 696 } // namespace v8::internal | 688 } // namespace v8::internal |
| 697 | 689 |
| 698 #endif // V8_TARGET_ARCH_X64 | 690 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |