| 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 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1970   if (result_saved) { |  1970   if (result_saved) { | 
|  1971     __ Drop(1);   // literal index |  1971     __ Drop(1);   // literal index | 
|  1972     context()->PlugTOS(); |  1972     context()->PlugTOS(); | 
|  1973   } else { |  1973   } else { | 
|  1974     context()->Plug(x0); |  1974     context()->Plug(x0); | 
|  1975   } |  1975   } | 
|  1976 } |  1976 } | 
|  1977  |  1977  | 
|  1978  |  1978  | 
|  1979 void FullCodeGenerator::VisitAssignment(Assignment* expr) { |  1979 void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 
|  1980   DCHECK(expr->target()->IsValidReferenceExpression()); |  1980   DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); | 
|  1981  |  1981  | 
|  1982   Comment cmnt(masm_, "[ Assignment"); |  1982   Comment cmnt(masm_, "[ Assignment"); | 
|  1983   SetExpressionPosition(expr, INSERT_BREAK); |  1983   SetExpressionPosition(expr, INSERT_BREAK); | 
|  1984  |  1984  | 
|  1985   Property* property = expr->target()->AsProperty(); |  1985   Property* property = expr->target()->AsProperty(); | 
|  1986   LhsKind assign_type = Property::GetAssignType(property); |  1986   LhsKind assign_type = Property::GetAssignType(property); | 
|  1987  |  1987  | 
|  1988   // Evaluate LHS expression. |  1988   // Evaluate LHS expression. | 
|  1989   switch (assign_type) { |  1989   switch (assign_type) { | 
|  1990     case VARIABLE: |  1990     case VARIABLE: | 
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2352     // Freeze the prototype. |  2352     // Freeze the prototype. | 
|  2353     __ CallRuntime(Runtime::kObjectFreeze, 1); |  2353     __ CallRuntime(Runtime::kObjectFreeze, 1); | 
|  2354     // Freeze the constructor. |  2354     // Freeze the constructor. | 
|  2355     __ CallRuntime(Runtime::kObjectFreeze, 1); |  2355     __ CallRuntime(Runtime::kObjectFreeze, 1); | 
|  2356   } |  2356   } | 
|  2357 } |  2357 } | 
|  2358  |  2358  | 
|  2359  |  2359  | 
|  2360 void FullCodeGenerator::EmitAssignment(Expression* expr, |  2360 void FullCodeGenerator::EmitAssignment(Expression* expr, | 
|  2361                                        FeedbackVectorICSlot slot) { |  2361                                        FeedbackVectorICSlot slot) { | 
|  2362   DCHECK(expr->IsValidReferenceExpression()); |  2362   DCHECK(expr->IsValidReferenceExpressionOrThis()); | 
|  2363  |  2363  | 
|  2364   Property* prop = expr->AsProperty(); |  2364   Property* prop = expr->AsProperty(); | 
|  2365   LhsKind assign_type = Property::GetAssignType(prop); |  2365   LhsKind assign_type = Property::GetAssignType(prop); | 
|  2366  |  2366  | 
|  2367   switch (assign_type) { |  2367   switch (assign_type) { | 
|  2368     case VARIABLE: { |  2368     case VARIABLE: { | 
|  2369       Variable* var = expr->AsVariableProxy()->var(); |  2369       Variable* var = expr->AsVariableProxy()->var(); | 
|  2370       EffectContext context(this); |  2370       EffectContext context(this); | 
|  2371       EmitVariableAssignment(var, Token::ASSIGN, slot); |  2371       EmitVariableAssignment(var, Token::ASSIGN, slot); | 
|  2372       break; |  2372       break; | 
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2501     Label const_error; |  2501     Label const_error; | 
|  2502     MemOperand location = VarOperand(var, x1); |  2502     MemOperand location = VarOperand(var, x1); | 
|  2503     __ Ldr(x10, location); |  2503     __ Ldr(x10, location); | 
|  2504     __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &const_error); |  2504     __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &const_error); | 
|  2505     __ Mov(x10, Operand(var->name())); |  2505     __ Mov(x10, Operand(var->name())); | 
|  2506     __ Push(x10); |  2506     __ Push(x10); | 
|  2507     __ CallRuntime(Runtime::kThrowReferenceError, 1); |  2507     __ CallRuntime(Runtime::kThrowReferenceError, 1); | 
|  2508     __ Bind(&const_error); |  2508     __ Bind(&const_error); | 
|  2509     __ CallRuntime(Runtime::kThrowConstAssignError, 0); |  2509     __ CallRuntime(Runtime::kThrowConstAssignError, 0); | 
|  2510  |  2510  | 
 |  2511   } else if (var->is_this() && op == Token::INIT_CONST) { | 
 |  2512     // Initializing assignment to const {this} needs a write barrier. | 
 |  2513     DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 
 |  2514     Label uninitialized_this; | 
 |  2515     MemOperand location = VarOperand(var, x1); | 
 |  2516     __ Ldr(x10, location); | 
 |  2517     __ JumpIfRoot(x10, Heap::kTheHoleValueRootIndex, &uninitialized_this); | 
 |  2518     __ Mov(x0, Operand(var->name())); | 
 |  2519     __ Push(x0); | 
 |  2520     __ CallRuntime(Runtime::kThrowReferenceError, 1); | 
 |  2521     __ bind(&uninitialized_this); | 
 |  2522     EmitStoreToStackLocalOrContextSlot(var, location); | 
 |  2523  | 
|  2511   } else if (!var->is_const_mode() || op == Token::INIT_CONST) { |  2524   } else if (!var->is_const_mode() || op == Token::INIT_CONST) { | 
|  2512     if (var->IsLookupSlot()) { |  2525     if (var->IsLookupSlot()) { | 
|  2513       // Assignment to var. |  2526       // Assignment to var. | 
|  2514       __ Mov(x11, Operand(var->name())); |  2527       __ Mov(x11, Operand(var->name())); | 
|  2515       __ Mov(x10, Smi::FromInt(language_mode())); |  2528       __ Mov(x10, Smi::FromInt(language_mode())); | 
|  2516       // jssp[0]  : mode. |  2529       // jssp[0]  : mode. | 
|  2517       // jssp[8]  : name. |  2530       // jssp[8]  : name. | 
|  2518       // jssp[16] : context. |  2531       // jssp[16] : context. | 
|  2519       // jssp[24] : value. |  2532       // jssp[24] : value. | 
|  2520       __ Push(x0, cp, x11, x10); |  2533       __ Push(x0, cp, x11, x10); | 
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2859   __ Mov(x12, Smi::FromInt(scope()->start_position())); |  2872   __ Mov(x12, Smi::FromInt(scope()->start_position())); | 
|  2860  |  2873  | 
|  2861   // Push. |  2874   // Push. | 
|  2862   __ Push(x9, x10, x11, x12); |  2875   __ Push(x9, x10, x11, x12); | 
|  2863  |  2876  | 
|  2864   // Do the runtime call. |  2877   // Do the runtime call. | 
|  2865   __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); |  2878   __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); | 
|  2866 } |  2879 } | 
|  2867  |  2880  | 
|  2868  |  2881  | 
|  2869 void FullCodeGenerator::EmitInitializeThisAfterSuper( |  | 
|  2870     SuperCallReference* super_ref, FeedbackVectorICSlot slot) { |  | 
|  2871   Variable* this_var = super_ref->this_var()->var(); |  | 
|  2872   GetVar(x1, this_var); |  | 
|  2873   Label uninitialized_this; |  | 
|  2874   __ JumpIfRoot(x1, Heap::kTheHoleValueRootIndex, &uninitialized_this); |  | 
|  2875   __ Mov(x0, Operand(this_var->name())); |  | 
|  2876   __ Push(x0); |  | 
|  2877   __ CallRuntime(Runtime::kThrowReferenceError, 1); |  | 
|  2878   __ bind(&uninitialized_this); |  | 
|  2879  |  | 
|  2880   EmitVariableAssignment(this_var, Token::INIT_CONST, slot); |  | 
|  2881 } |  | 
|  2882  |  | 
|  2883  |  | 
|  2884 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |  2882 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 
|  2885 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |  2883 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 
|  2886   VariableProxy* callee = expr->expression()->AsVariableProxy(); |  2884   VariableProxy* callee = expr->expression()->AsVariableProxy(); | 
|  2887   if (callee->var()->IsLookupSlot()) { |  2885   if (callee->var()->IsLookupSlot()) { | 
|  2888     Label slow, done; |  2886     Label slow, done; | 
|  2889     SetExpressionPosition(callee); |  2887     SetExpressionPosition(callee); | 
|  2890       // Generate code for loading from variables potentially shadowed |  2888       // Generate code for loading from variables potentially shadowed | 
|  2891       // by eval-introduced variables. |  2889       // by eval-introduced variables. | 
|  2892       EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); |  2890       EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); | 
|  2893  |  2891  | 
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3096   } |  3094   } | 
|  3097  |  3095  | 
|  3098   __ LoadObject(x2, FeedbackVector()); |  3096   __ LoadObject(x2, FeedbackVector()); | 
|  3099   __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot())); |  3097   __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot())); | 
|  3100  |  3098  | 
|  3101   CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); |  3099   CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); | 
|  3102   __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |  3100   __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 
|  3103  |  3101  | 
|  3104   RecordJSReturnSite(expr); |  3102   RecordJSReturnSite(expr); | 
|  3105  |  3103  | 
|  3106   EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); |  | 
|  3107   context()->Plug(x0); |  3104   context()->Plug(x0); | 
|  3108 } |  3105 } | 
|  3109  |  3106  | 
|  3110  |  3107  | 
|  3111 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |  3108 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 
|  3112   ZoneList<Expression*>* args = expr->arguments(); |  3109   ZoneList<Expression*>* args = expr->arguments(); | 
|  3113   DCHECK(args->length() == 1); |  3110   DCHECK(args->length() == 1); | 
|  3114  |  3111  | 
|  3115   VisitForAccumulatorValue(args->at(0)); |  3112   VisitForAccumulatorValue(args->at(0)); | 
|  3116  |  3113  | 
| (...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4427  |  4424  | 
|  4428   // Push NewTarget |  4425   // Push NewTarget | 
|  4429   DCHECK(args->at(2)->IsVariableProxy()); |  4426   DCHECK(args->at(2)->IsVariableProxy()); | 
|  4430   VisitForStackValue(args->at(2)); |  4427   VisitForStackValue(args->at(2)); | 
|  4431  |  4428  | 
|  4432   EmitCallJSRuntimeFunction(call); |  4429   EmitCallJSRuntimeFunction(call); | 
|  4433  |  4430  | 
|  4434   // Restore context register. |  4431   // Restore context register. | 
|  4435   __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |  4432   __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 
|  4436   context()->DropAndPlug(1, x0); |  4433   context()->DropAndPlug(1, x0); | 
|  4437  |  | 
|  4438   // TODO(mvstanton): with FLAG_vector_stores this needs a slot id. |  | 
|  4439   EmitInitializeThisAfterSuper(super_call_ref); |  | 
|  4440 } |  4434 } | 
|  4441  |  4435  | 
|  4442  |  4436  | 
|  4443 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |  4437 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 
|  4444   // Push the builtins object as the receiver. |  4438   // Push the builtins object as the receiver. | 
|  4445   __ Ldr(x10, GlobalObjectMemOperand()); |  4439   __ Ldr(x10, GlobalObjectMemOperand()); | 
|  4446   __ Ldr(LoadDescriptor::ReceiverRegister(), |  4440   __ Ldr(LoadDescriptor::ReceiverRegister(), | 
|  4447          FieldMemOperand(x10, GlobalObject::kBuiltinsOffset)); |  4441          FieldMemOperand(x10, GlobalObject::kBuiltinsOffset)); | 
|  4448   __ Push(LoadDescriptor::ReceiverRegister()); |  4442   __ Push(LoadDescriptor::ReceiverRegister()); | 
|  4449  |  4443  | 
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4625       context()->Plug(x0); |  4619       context()->Plug(x0); | 
|  4626       break; |  4620       break; | 
|  4627     } |  4621     } | 
|  4628     default: |  4622     default: | 
|  4629       UNREACHABLE(); |  4623       UNREACHABLE(); | 
|  4630   } |  4624   } | 
|  4631 } |  4625 } | 
|  4632  |  4626  | 
|  4633  |  4627  | 
|  4634 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |  4628 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 
|  4635   DCHECK(expr->expression()->IsValidReferenceExpression()); |  4629   DCHECK(expr->expression()->IsValidReferenceExpressionOrThis()); | 
|  4636  |  4630  | 
|  4637   Comment cmnt(masm_, "[ CountOperation"); |  4631   Comment cmnt(masm_, "[ CountOperation"); | 
|  4638  |  4632  | 
|  4639   Property* prop = expr->expression()->AsProperty(); |  4633   Property* prop = expr->expression()->AsProperty(); | 
|  4640   LhsKind assign_type = Property::GetAssignType(prop); |  4634   LhsKind assign_type = Property::GetAssignType(prop); | 
|  4641  |  4635  | 
|  4642   // Evaluate expression and get value. |  4636   // Evaluate expression and get value. | 
|  4643   if (assign_type == VARIABLE) { |  4637   if (assign_type == VARIABLE) { | 
|  4644     DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); |  4638     DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); | 
|  4645     AccumulatorValueContext context(this); |  4639     AccumulatorValueContext context(this); | 
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5613   } |  5607   } | 
|  5614  |  5608  | 
|  5615   return INTERRUPT; |  5609   return INTERRUPT; | 
|  5616 } |  5610 } | 
|  5617  |  5611  | 
|  5618  |  5612  | 
|  5619 }  // namespace internal |  5613 }  // namespace internal | 
|  5620 }  // namespace v8 |  5614 }  // namespace v8 | 
|  5621  |  5615  | 
|  5622 #endif  // V8_TARGET_ARCH_ARM64 |  5616 #endif  // V8_TARGET_ARCH_ARM64 | 
| OLD | NEW |