| 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 "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/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 int num_parameters = info->scope()->num_parameters(); | 255 int num_parameters = info->scope()->num_parameters(); |
| 256 int offset = num_parameters * kPointerSize; | 256 int offset = num_parameters * kPointerSize; |
| 257 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset + offset); | 257 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset + offset); |
| 258 __ Mov(x1, Smi::FromInt(num_parameters)); | 258 __ Mov(x1, Smi::FromInt(num_parameters)); |
| 259 __ Push(x3, x2, x1); | 259 __ Push(x3, x2, x1); |
| 260 | 260 |
| 261 // Arguments to ArgumentsAccessStub: | 261 // Arguments to ArgumentsAccessStub: |
| 262 // function, receiver address, parameter count. | 262 // function, receiver address, parameter count. |
| 263 // The stub will rewrite receiver and parameter count if the previous | 263 // The stub will rewrite receiver and parameter count if the previous |
| 264 // stack frame was an arguments adapter frame. | 264 // stack frame was an arguments adapter frame. |
| 265 ArgumentsAccessStub::HasNewTarget has_new_target = | |
| 266 IsSubclassConstructor(info->function()->kind()) | |
| 267 ? ArgumentsAccessStub::HAS_NEW_TARGET | |
| 268 : ArgumentsAccessStub::NO_NEW_TARGET; | |
| 269 ArgumentsAccessStub::Type type; | 265 ArgumentsAccessStub::Type type; |
| 270 if (is_strict(language_mode())) { | 266 if (is_strict(language_mode())) { |
| 271 type = ArgumentsAccessStub::NEW_STRICT; | 267 type = ArgumentsAccessStub::NEW_STRICT; |
| 272 } else if (function()->has_duplicate_parameters()) { | 268 } else if (function()->has_duplicate_parameters()) { |
| 273 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 269 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
| 274 } else { | 270 } else { |
| 275 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 271 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
| 276 } | 272 } |
| 277 ArgumentsAccessStub stub(isolate(), type, has_new_target); | 273 ArgumentsAccessStub stub(isolate(), type); |
| 278 __ CallStub(&stub); | 274 __ CallStub(&stub); |
| 279 | 275 |
| 280 SetVar(arguments, x0, x1, x2); | 276 SetVar(arguments, x0, x1, x2); |
| 281 } | 277 } |
| 282 | 278 |
| 283 if (FLAG_trace) { | 279 if (FLAG_trace) { |
| 284 __ CallRuntime(Runtime::kTraceEnter, 0); | 280 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 285 } | 281 } |
| 286 | 282 |
| 287 | 283 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 __ mov(current_sp, fp); | 448 __ mov(current_sp, fp); |
| 453 int no_frame_start = masm_->pc_offset(); | 449 int no_frame_start = masm_->pc_offset(); |
| 454 __ ldp(fp, lr, MemOperand(current_sp, 2 * kXRegSize, PostIndex)); | 450 __ ldp(fp, lr, MemOperand(current_sp, 2 * kXRegSize, PostIndex)); |
| 455 // Drop the arguments and receiver and return. | 451 // Drop the arguments and receiver and return. |
| 456 // TODO(all): This implementation is overkill as it supports 2**31+1 | 452 // TODO(all): This implementation is overkill as it supports 2**31+1 |
| 457 // arguments, consider how to improve it without creating a security | 453 // arguments, consider how to improve it without creating a security |
| 458 // hole. | 454 // hole. |
| 459 __ ldr_pcrel(ip0, (3 * kInstructionSize) >> kLoadLiteralScaleLog2); | 455 __ ldr_pcrel(ip0, (3 * kInstructionSize) >> kLoadLiteralScaleLog2); |
| 460 __ add(current_sp, current_sp, ip0); | 456 __ add(current_sp, current_sp, ip0); |
| 461 __ ret(); | 457 __ ret(); |
| 462 int32_t arg_count = info_->scope()->num_parameters() + 1; | 458 __ dc64(kXRegSize * (info_->scope()->num_parameters() + 1)); |
| 463 if (FLAG_experimental_classes && | |
| 464 IsSubclassConstructor(info_->function()->kind())) { | |
| 465 arg_count++; | |
| 466 } | |
| 467 __ dc64(kXRegSize * arg_count); | |
| 468 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 459 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 469 } | 460 } |
| 470 } | 461 } |
| 471 } | 462 } |
| 472 | 463 |
| 473 | 464 |
| 474 void FullCodeGenerator::EffectContext::Plug(Variable* var) const { | 465 void FullCodeGenerator::EffectContext::Plug(Variable* var) const { |
| 475 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 466 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 476 } | 467 } |
| 477 | 468 |
| (...skipping 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2948 __ Mov(x3, SmiFromSlot(expr->CallNewFeedbackSlot())); | 2939 __ Mov(x3, SmiFromSlot(expr->CallNewFeedbackSlot())); |
| 2949 | 2940 |
| 2950 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 2941 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
| 2951 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 2942 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 2952 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2943 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
| 2953 context()->Plug(x0); | 2944 context()->Plug(x0); |
| 2954 } | 2945 } |
| 2955 | 2946 |
| 2956 | 2947 |
| 2957 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | 2948 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
| 2958 Comment cmnt(masm_, "[ SuperConstructorCall"); | |
| 2959 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); | |
| 2960 GetVar(result_register(), new_target_var); | |
| 2961 __ Push(result_register()); | |
| 2962 | |
| 2963 SuperReference* super_ref = expr->expression()->AsSuperReference(); | 2949 SuperReference* super_ref = expr->expression()->AsSuperReference(); |
| 2964 EmitLoadSuperConstructor(super_ref); | 2950 EmitLoadSuperConstructor(super_ref); |
| 2965 __ push(result_register()); | 2951 __ push(result_register()); |
| 2966 | 2952 |
| 2967 Variable* this_var = super_ref->this_var()->var(); | 2953 Variable* this_var = super_ref->this_var()->var(); |
| 2968 | 2954 |
| 2969 GetVar(x0, this_var); | 2955 GetVar(x0, this_var); |
| 2970 Label uninitialized_this; | 2956 Label uninitialized_this; |
| 2971 __ JumpIfRoot(x0, Heap::kTheHoleValueRootIndex, &uninitialized_this); | 2957 __ JumpIfRoot(x0, Heap::kTheHoleValueRootIndex, &uninitialized_this); |
| 2972 __ Mov(x0, Operand(this_var->name())); | 2958 __ Mov(x0, Operand(this_var->name())); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2995 /* TODO(dslomov): support pretenuring. | 2981 /* TODO(dslomov): support pretenuring. |
| 2996 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 2982 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
| 2997 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == | 2983 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
| 2998 expr->CallNewFeedbackSlot().ToInt() + 1); | 2984 expr->CallNewFeedbackSlot().ToInt() + 1); |
| 2999 */ | 2985 */ |
| 3000 } | 2986 } |
| 3001 | 2987 |
| 3002 __ LoadObject(x2, FeedbackVector()); | 2988 __ LoadObject(x2, FeedbackVector()); |
| 3003 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot())); | 2989 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot())); |
| 3004 | 2990 |
| 3005 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); | 2991 // TODO(dslomov): use a different stub and propagate new.target. |
| 2992 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
| 3006 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 2993 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 3007 | 2994 |
| 3008 __ Drop(1); | |
| 3009 | |
| 3010 RecordJSReturnSite(expr); | 2995 RecordJSReturnSite(expr); |
| 3011 | 2996 |
| 3012 EmitVariableAssignment(this_var, Token::INIT_CONST); | 2997 EmitVariableAssignment(this_var, Token::INIT_CONST); |
| 3013 context()->Plug(x0); | 2998 context()->Plug(x0); |
| 3014 } | 2999 } |
| 3015 | 3000 |
| 3016 | 3001 |
| 3017 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3002 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
| 3018 ZoneList<Expression*>* args = expr->arguments(); | 3003 ZoneList<Expression*>* args = expr->arguments(); |
| 3019 DCHECK(args->length() == 1); | 3004 DCHECK(args->length() == 1); |
| (...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5420 return previous_; | 5405 return previous_; |
| 5421 } | 5406 } |
| 5422 | 5407 |
| 5423 | 5408 |
| 5424 #undef __ | 5409 #undef __ |
| 5425 | 5410 |
| 5426 | 5411 |
| 5427 } } // namespace v8::internal | 5412 } } // namespace v8::internal |
| 5428 | 5413 |
| 5429 #endif // V8_TARGET_ARCH_ARM64 | 5414 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |