| 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 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
| 8 | 8 |
| 9 #include "code-stubs.h" | 9 #include "code-stubs.h" |
| 10 #include "codegen.h" | 10 #include "codegen.h" |
| (...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1962 break; | 1962 break; |
| 1963 case KEYED_PROPERTY: | 1963 case KEYED_PROPERTY: |
| 1964 EmitKeyedPropertyAssignment(expr); | 1964 EmitKeyedPropertyAssignment(expr); |
| 1965 break; | 1965 break; |
| 1966 } | 1966 } |
| 1967 } | 1967 } |
| 1968 | 1968 |
| 1969 | 1969 |
| 1970 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 1970 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 1971 SetSourcePosition(prop->position()); | 1971 SetSourcePosition(prop->position()); |
| 1972 Literal* key = prop->key()->AsLiteral(); | 1972 Literal* key = prop->key()->AsStringLiteral(); |
| 1973 __ Mov(x2, Operand(key->value())); | 1973 __ Mov(x2, Operand(key->value())); |
| 1974 // Call load IC. It has arguments receiver and property name x0 and x2. | 1974 // Call load IC. It has arguments receiver and property name x0 and x2. |
| 1975 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 1975 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
| 1976 } | 1976 } |
| 1977 | 1977 |
| 1978 | 1978 |
| 1979 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 1979 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 1980 SetSourcePosition(prop->position()); | 1980 SetSourcePosition(prop->position()); |
| 1981 // Call keyed load IC. It has arguments key and receiver in r0 and r1. | 1981 // Call keyed load IC. It has arguments key and receiver in r0 and r1. |
| 1982 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 1982 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 EmitVariableAssignment(var, Token::ASSIGN); | 2120 EmitVariableAssignment(var, Token::ASSIGN); |
| 2121 break; | 2121 break; |
| 2122 } | 2122 } |
| 2123 case NAMED_PROPERTY: { | 2123 case NAMED_PROPERTY: { |
| 2124 __ Push(x0); // Preserve value. | 2124 __ Push(x0); // Preserve value. |
| 2125 VisitForAccumulatorValue(prop->obj()); | 2125 VisitForAccumulatorValue(prop->obj()); |
| 2126 // TODO(all): We could introduce a VisitForRegValue(reg, expr) to avoid | 2126 // TODO(all): We could introduce a VisitForRegValue(reg, expr) to avoid |
| 2127 // this copy. | 2127 // this copy. |
| 2128 __ Mov(x1, x0); | 2128 __ Mov(x1, x0); |
| 2129 __ Pop(x0); // Restore value. | 2129 __ Pop(x0); // Restore value. |
| 2130 __ Mov(x2, Operand(prop->key()->AsLiteral()->value())); | 2130 __ Mov(x2, Operand(prop->key()->AsStringLiteral()->value())); |
| 2131 CallStoreIC(); | 2131 CallStoreIC(); |
| 2132 break; | 2132 break; |
| 2133 } | 2133 } |
| 2134 case KEYED_PROPERTY: { | 2134 case KEYED_PROPERTY: { |
| 2135 __ Push(x0); // Preserve value. | 2135 __ Push(x0); // Preserve value. |
| 2136 VisitForStackValue(prop->obj()); | 2136 VisitForStackValue(prop->obj()); |
| 2137 VisitForAccumulatorValue(prop->key()); | 2137 VisitForAccumulatorValue(prop->key()); |
| 2138 __ Mov(x1, x0); | 2138 __ Mov(x1, x0); |
| 2139 __ Pop(x2, x0); | 2139 __ Pop(x2, x0); |
| 2140 Handle<Code> ic = strict_mode() == SLOPPY | 2140 Handle<Code> ic = strict_mode() == SLOPPY |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2237 } | 2237 } |
| 2238 // Non-initializing assignments to consts are ignored. | 2238 // Non-initializing assignments to consts are ignored. |
| 2239 } | 2239 } |
| 2240 | 2240 |
| 2241 | 2241 |
| 2242 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2242 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
| 2243 ASM_LOCATION("FullCodeGenerator::EmitNamedPropertyAssignment"); | 2243 ASM_LOCATION("FullCodeGenerator::EmitNamedPropertyAssignment"); |
| 2244 // Assignment to a property, using a named store IC. | 2244 // Assignment to a property, using a named store IC. |
| 2245 Property* prop = expr->target()->AsProperty(); | 2245 Property* prop = expr->target()->AsProperty(); |
| 2246 ASSERT(prop != NULL); | 2246 ASSERT(prop != NULL); |
| 2247 ASSERT(prop->key()->AsLiteral() != NULL); | 2247 ASSERT(prop->key()->AsStringLiteral() != NULL); |
| 2248 | 2248 |
| 2249 // Record source code position before IC call. | 2249 // Record source code position before IC call. |
| 2250 SetSourcePosition(expr->position()); | 2250 SetSourcePosition(expr->position()); |
| 2251 __ Mov(x2, Operand(prop->key()->AsLiteral()->value())); | 2251 __ Mov(x2, Operand(prop->key()->AsStringLiteral()->value())); |
| 2252 __ Pop(x1); | 2252 __ Pop(x1); |
| 2253 | 2253 |
| 2254 CallStoreIC(expr->AssignmentFeedbackId()); | 2254 CallStoreIC(expr->AssignmentFeedbackId()); |
| 2255 | 2255 |
| 2256 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2256 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 2257 context()->Plug(x0); | 2257 context()->Plug(x0); |
| 2258 } | 2258 } |
| 2259 | 2259 |
| 2260 | 2260 |
| 2261 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 2261 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3093 __ Ldr(x0, FieldMemOperand(x0, JSValue::kValueOffset)); | 3093 __ Ldr(x0, FieldMemOperand(x0, JSValue::kValueOffset)); |
| 3094 | 3094 |
| 3095 __ Bind(&done); | 3095 __ Bind(&done); |
| 3096 context()->Plug(x0); | 3096 context()->Plug(x0); |
| 3097 } | 3097 } |
| 3098 | 3098 |
| 3099 | 3099 |
| 3100 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { | 3100 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
| 3101 ZoneList<Expression*>* args = expr->arguments(); | 3101 ZoneList<Expression*>* args = expr->arguments(); |
| 3102 ASSERT(args->length() == 2); | 3102 ASSERT(args->length() == 2); |
| 3103 ASSERT_NE(NULL, args->at(1)->AsLiteral()); | 3103 ASSERT_NE(NULL, args->at(1)->AsNumberLiteral()); |
| 3104 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); | 3104 Smi* index = Smi::cast(*(args->at(1)->AsNumberLiteral()->value())); |
| 3105 | 3105 |
| 3106 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3106 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 3107 | 3107 |
| 3108 Label runtime, done, not_date_object; | 3108 Label runtime, done, not_date_object; |
| 3109 Register object = x0; | 3109 Register object = x0; |
| 3110 Register result = x0; | 3110 Register result = x0; |
| 3111 Register stamp_addr = x10; | 3111 Register stamp_addr = x10; |
| 3112 Register stamp_cache = x11; | 3112 Register stamp_cache = x11; |
| 3113 | 3113 |
| 3114 __ JumpIfSmi(object, ¬_date_object); | 3114 __ JumpIfSmi(object, ¬_date_object); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3439 VisitForAccumulatorValue(args->at(2)); | 3439 VisitForAccumulatorValue(args->at(2)); |
| 3440 __ Pop(x1, x2); | 3440 __ Pop(x1, x2); |
| 3441 __ CallStub(&stub); | 3441 __ CallStub(&stub); |
| 3442 context()->Plug(x0); | 3442 context()->Plug(x0); |
| 3443 } | 3443 } |
| 3444 | 3444 |
| 3445 | 3445 |
| 3446 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { | 3446 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { |
| 3447 ZoneList<Expression*>* args = expr->arguments(); | 3447 ZoneList<Expression*>* args = expr->arguments(); |
| 3448 ASSERT_EQ(2, args->length()); | 3448 ASSERT_EQ(2, args->length()); |
| 3449 ASSERT_NE(NULL, args->at(0)->AsLiteral()); | 3449 ASSERT_NE(NULL, args->at(0)->AsNumberLiteral()); |
| 3450 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); | 3450 int cache_id = Smi::cast(*(args->at(0)->AsNumberLiteral()->value()))->value(); |
| 3451 | 3451 |
| 3452 Handle<FixedArray> jsfunction_result_caches( | 3452 Handle<FixedArray> jsfunction_result_caches( |
| 3453 isolate()->native_context()->jsfunction_result_caches()); | 3453 isolate()->native_context()->jsfunction_result_caches()); |
| 3454 if (jsfunction_result_caches->length() <= cache_id) { | 3454 if (jsfunction_result_caches->length() <= cache_id) { |
| 3455 __ Abort(kAttemptToUseUndefinedCache); | 3455 __ Abort(kAttemptToUseUndefinedCache); |
| 3456 __ LoadRoot(x0, Heap::kUndefinedValueRootIndex); | 3456 __ LoadRoot(x0, Heap::kUndefinedValueRootIndex); |
| 3457 context()->Plug(x0); | 3457 context()->Plug(x0); |
| 3458 return; | 3458 return; |
| 3459 } | 3459 } |
| 3460 | 3460 |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4047 context()->PlugTOS(); | 4047 context()->PlugTOS(); |
| 4048 } | 4048 } |
| 4049 } else { | 4049 } else { |
| 4050 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 4050 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
| 4051 Token::ASSIGN); | 4051 Token::ASSIGN); |
| 4052 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4052 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 4053 context()->Plug(x0); | 4053 context()->Plug(x0); |
| 4054 } | 4054 } |
| 4055 break; | 4055 break; |
| 4056 case NAMED_PROPERTY: { | 4056 case NAMED_PROPERTY: { |
| 4057 __ Mov(x2, Operand(prop->key()->AsLiteral()->value())); | 4057 __ Mov(x2, Operand(prop->key()->AsStringLiteral()->value())); |
| 4058 __ Pop(x1); | 4058 __ Pop(x1); |
| 4059 CallStoreIC(expr->CountStoreFeedbackId()); | 4059 CallStoreIC(expr->CountStoreFeedbackId()); |
| 4060 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4060 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 4061 if (expr->is_postfix()) { | 4061 if (expr->is_postfix()) { |
| 4062 if (!context()->IsEffect()) { | 4062 if (!context()->IsEffect()) { |
| 4063 context()->PlugTOS(); | 4063 context()->PlugTOS(); |
| 4064 } | 4064 } |
| 4065 } else { | 4065 } else { |
| 4066 context()->Plug(x0); | 4066 context()->Plug(x0); |
| 4067 } | 4067 } |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4896 return previous_; | 4896 return previous_; |
| 4897 } | 4897 } |
| 4898 | 4898 |
| 4899 | 4899 |
| 4900 #undef __ | 4900 #undef __ |
| 4901 | 4901 |
| 4902 | 4902 |
| 4903 } } // namespace v8::internal | 4903 } } // namespace v8::internal |
| 4904 | 4904 |
| 4905 #endif // V8_TARGET_ARCH_ARM64 | 4905 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |