| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "arm64/lithium-codegen-arm64.h" | 7 #include "arm64/lithium-codegen-arm64.h" |
| 8 #include "arm64/lithium-gap-resolver-arm64.h" | 8 #include "arm64/lithium-gap-resolver-arm64.h" |
| 9 #include "code-stubs.h" | 9 #include "code-stubs.h" |
| 10 #include "stub-cache.h" | 10 #include "stub-cache.h" |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 } | 687 } |
| 688 | 688 |
| 689 if (info()->saves_caller_doubles()) { | 689 if (info()->saves_caller_doubles()) { |
| 690 SaveCallerDoubles(); | 690 SaveCallerDoubles(); |
| 691 } | 691 } |
| 692 | 692 |
| 693 // Allocate a local context if needed. | 693 // Allocate a local context if needed. |
| 694 int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 694 int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 695 if (heap_slots > 0) { | 695 if (heap_slots > 0) { |
| 696 Comment(";;; Allocate local context"); | 696 Comment(";;; Allocate local context"); |
| 697 bool need_write_barrier = true; |
| 697 // Argument to NewContext is the function, which is in x1. | 698 // Argument to NewContext is the function, which is in x1. |
| 698 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 699 if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
| 699 FastNewContextStub stub(isolate(), heap_slots); | 700 FastNewContextStub stub(isolate(), heap_slots); |
| 700 __ CallStub(&stub); | 701 __ CallStub(&stub); |
| 702 // Result of FastNewContextStub is always in new space. |
| 703 need_write_barrier = false; |
| 701 } else { | 704 } else { |
| 702 __ Push(x1); | 705 __ Push(x1); |
| 703 __ CallRuntime(Runtime::kHiddenNewFunctionContext, 1); | 706 __ CallRuntime(Runtime::kHiddenNewFunctionContext, 1); |
| 704 } | 707 } |
| 705 RecordSafepoint(Safepoint::kNoLazyDeopt); | 708 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 706 // Context is returned in x0. It replaces the context passed to us. It's | 709 // Context is returned in x0. It replaces the context passed to us. It's |
| 707 // saved in the stack and kept live in cp. | 710 // saved in the stack and kept live in cp. |
| 708 __ Mov(cp, x0); | 711 __ Mov(cp, x0); |
| 709 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 712 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 710 // Copy any necessary parameters into the context. | 713 // Copy any necessary parameters into the context. |
| 711 int num_parameters = scope()->num_parameters(); | 714 int num_parameters = scope()->num_parameters(); |
| 712 for (int i = 0; i < num_parameters; i++) { | 715 for (int i = 0; i < num_parameters; i++) { |
| 713 Variable* var = scope()->parameter(i); | 716 Variable* var = scope()->parameter(i); |
| 714 if (var->IsContextSlot()) { | 717 if (var->IsContextSlot()) { |
| 715 Register value = x0; | 718 Register value = x0; |
| 716 Register scratch = x3; | 719 Register scratch = x3; |
| 717 | 720 |
| 718 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 721 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
| 719 (num_parameters - 1 - i) * kPointerSize; | 722 (num_parameters - 1 - i) * kPointerSize; |
| 720 // Load parameter from stack. | 723 // Load parameter from stack. |
| 721 __ Ldr(value, MemOperand(fp, parameter_offset)); | 724 __ Ldr(value, MemOperand(fp, parameter_offset)); |
| 722 // Store it in the context. | 725 // Store it in the context. |
| 723 MemOperand target = ContextMemOperand(cp, var->index()); | 726 MemOperand target = ContextMemOperand(cp, var->index()); |
| 724 __ Str(value, target); | 727 __ Str(value, target); |
| 725 // Update the write barrier. This clobbers value and scratch. | 728 // Update the write barrier. This clobbers value and scratch. |
| 726 __ RecordWriteContextSlot(cp, target.offset(), value, scratch, | 729 if (need_write_barrier) { |
| 727 GetLinkRegisterState(), kSaveFPRegs); | 730 __ RecordWriteContextSlot(cp, target.offset(), value, scratch, |
| 731 GetLinkRegisterState(), kSaveFPRegs); |
| 732 } else if (FLAG_debug_code) { |
| 733 Label done; |
| 734 __ JumpIfInNewSpace(cp, &done); |
| 735 __ Abort(kExpectedNewSpaceObject); |
| 736 __ bind(&done); |
| 737 } |
| 728 } | 738 } |
| 729 } | 739 } |
| 730 Comment(";;; End allocate local context"); | 740 Comment(";;; End allocate local context"); |
| 731 } | 741 } |
| 732 | 742 |
| 733 // Trace the call. | 743 // Trace the call. |
| 734 if (FLAG_trace && info()->IsOptimizing()) { | 744 if (FLAG_trace && info()->IsOptimizing()) { |
| 735 // We have not executed any compiled code yet, so cp still holds the | 745 // We have not executed any compiled code yet, so cp still holds the |
| 736 // incoming context. | 746 // incoming context. |
| 737 __ CallRuntime(Runtime::kTraceEnter, 0); | 747 __ CallRuntime(Runtime::kTraceEnter, 0); |
| (...skipping 5270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6008 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 6018 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 6009 // Index is equal to negated out of object property index plus 1. | 6019 // Index is equal to negated out of object property index plus 1. |
| 6010 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 6020 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 6011 __ Ldr(result, FieldMemOperand(result, | 6021 __ Ldr(result, FieldMemOperand(result, |
| 6012 FixedArray::kHeaderSize - kPointerSize)); | 6022 FixedArray::kHeaderSize - kPointerSize)); |
| 6013 __ Bind(deferred->exit()); | 6023 __ Bind(deferred->exit()); |
| 6014 __ Bind(&done); | 6024 __ Bind(&done); |
| 6015 } | 6025 } |
| 6016 | 6026 |
| 6017 } } // namespace v8::internal | 6027 } } // namespace v8::internal |
| OLD | NEW |