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 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2011 EmitKeyedPropertyLoad(property); | 2011 EmitKeyedPropertyLoad(property); |
2012 PrepareForBailoutForId(property->LoadId(), TOS_REG); | 2012 PrepareForBailoutForId(property->LoadId(), TOS_REG); |
2013 break; | 2013 break; |
2014 } | 2014 } |
2015 } | 2015 } |
2016 | 2016 |
2017 Token::Value op = expr->binary_op(); | 2017 Token::Value op = expr->binary_op(); |
2018 __ Push(x0); // Left operand goes on the stack. | 2018 __ Push(x0); // Left operand goes on the stack. |
2019 VisitForAccumulatorValue(expr->value()); | 2019 VisitForAccumulatorValue(expr->value()); |
2020 | 2020 |
2021 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() | |
2022 ? OVERWRITE_RIGHT | |
2023 : NO_OVERWRITE; | |
2024 SetSourcePosition(expr->position() + 1); | 2021 SetSourcePosition(expr->position() + 1); |
2025 AccumulatorValueContext context(this); | 2022 AccumulatorValueContext context(this); |
2026 if (ShouldInlineSmiCase(op)) { | 2023 if (ShouldInlineSmiCase(op)) { |
2027 EmitInlineSmiBinaryOp(expr->binary_operation(), | 2024 EmitInlineSmiBinaryOp(expr->binary_operation(), |
2028 op, | 2025 op, |
2029 mode, | |
2030 expr->target(), | 2026 expr->target(), |
2031 expr->value()); | 2027 expr->value()); |
2032 } else { | 2028 } else { |
2033 EmitBinaryOp(expr->binary_operation(), op, mode); | 2029 EmitBinaryOp(expr->binary_operation(), op); |
2034 } | 2030 } |
2035 | 2031 |
2036 // Deoptimization point in case the binary operation may have side effects. | 2032 // Deoptimization point in case the binary operation may have side effects. |
2037 PrepareForBailout(expr->binary_operation(), TOS_REG); | 2033 PrepareForBailout(expr->binary_operation(), TOS_REG); |
2038 } else { | 2034 } else { |
2039 VisitForAccumulatorValue(expr->value()); | 2035 VisitForAccumulatorValue(expr->value()); |
2040 } | 2036 } |
2041 | 2037 |
2042 // Record source position before possible IC call. | 2038 // Record source position before possible IC call. |
2043 SetSourcePosition(expr->position()); | 2039 SetSourcePosition(expr->position()); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2113 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2109 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2114 // Stack: receiver, home_object, key. | 2110 // Stack: receiver, home_object, key. |
2115 SetSourcePosition(prop->position()); | 2111 SetSourcePosition(prop->position()); |
2116 | 2112 |
2117 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2113 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
2118 } | 2114 } |
2119 | 2115 |
2120 | 2116 |
2121 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2117 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
2122 Token::Value op, | 2118 Token::Value op, |
2123 OverwriteMode mode, | |
2124 Expression* left_expr, | 2119 Expression* left_expr, |
2125 Expression* right_expr) { | 2120 Expression* right_expr) { |
2126 Label done, both_smis, stub_call; | 2121 Label done, both_smis, stub_call; |
2127 | 2122 |
2128 // Get the arguments. | 2123 // Get the arguments. |
2129 Register left = x1; | 2124 Register left = x1; |
2130 Register right = x0; | 2125 Register right = x0; |
2131 Register result = x0; | 2126 Register result = x0; |
2132 __ Pop(left); | 2127 __ Pop(left); |
2133 | 2128 |
2134 // Perform combined smi check on both operands. | 2129 // Perform combined smi check on both operands. |
2135 __ Orr(x10, left, right); | 2130 __ Orr(x10, left, right); |
2136 JumpPatchSite patch_site(masm_); | 2131 JumpPatchSite patch_site(masm_); |
2137 patch_site.EmitJumpIfSmi(x10, &both_smis); | 2132 patch_site.EmitJumpIfSmi(x10, &both_smis); |
2138 | 2133 |
2139 __ Bind(&stub_call); | 2134 __ Bind(&stub_call); |
2140 | 2135 |
2141 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); | 2136 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
2142 { | 2137 { |
2143 Assembler::BlockPoolsScope scope(masm_); | 2138 Assembler::BlockPoolsScope scope(masm_); |
2144 CallIC(code, expr->BinaryOperationFeedbackId()); | 2139 CallIC(code, expr->BinaryOperationFeedbackId()); |
2145 patch_site.EmitPatchInfo(); | 2140 patch_site.EmitPatchInfo(); |
2146 } | 2141 } |
2147 __ B(&done); | 2142 __ B(&done); |
2148 | 2143 |
2149 __ Bind(&both_smis); | 2144 __ Bind(&both_smis); |
2150 // Smi case. This code works in the same way as the smi-smi case in the type | 2145 // Smi case. This code works in the same way as the smi-smi case in the type |
2151 // recording binary operation stub, see | 2146 // recording binary operation stub, see |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2211 break; | 2206 break; |
2212 default: | 2207 default: |
2213 UNREACHABLE(); | 2208 UNREACHABLE(); |
2214 } | 2209 } |
2215 | 2210 |
2216 __ Bind(&done); | 2211 __ Bind(&done); |
2217 context()->Plug(x0); | 2212 context()->Plug(x0); |
2218 } | 2213 } |
2219 | 2214 |
2220 | 2215 |
2221 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 2216 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2222 Token::Value op, | |
2223 OverwriteMode mode) { | |
2224 __ Pop(x1); | 2217 __ Pop(x1); |
2225 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); | 2218 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
2226 JumpPatchSite patch_site(masm_); // Unbound, signals no inlined smi code. | 2219 JumpPatchSite patch_site(masm_); // Unbound, signals no inlined smi code. |
2227 { | 2220 { |
2228 Assembler::BlockPoolsScope scope(masm_); | 2221 Assembler::BlockPoolsScope scope(masm_); |
2229 CallIC(code, expr->BinaryOperationFeedbackId()); | 2222 CallIC(code, expr->BinaryOperationFeedbackId()); |
2230 patch_site.EmitPatchInfo(); | 2223 patch_site.EmitPatchInfo(); |
2231 } | 2224 } |
2232 context()->Plug(x0); | 2225 context()->Plug(x0); |
2233 } | 2226 } |
2234 | 2227 |
2235 | 2228 |
(...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4523 | 4516 |
4524 __ Bind(&stub_call); | 4517 __ Bind(&stub_call); |
4525 __ Mov(x1, x0); | 4518 __ Mov(x1, x0); |
4526 __ Mov(x0, Smi::FromInt(count_value)); | 4519 __ Mov(x0, Smi::FromInt(count_value)); |
4527 | 4520 |
4528 // Record position before stub call. | 4521 // Record position before stub call. |
4529 SetSourcePosition(expr->position()); | 4522 SetSourcePosition(expr->position()); |
4530 | 4523 |
4531 { | 4524 { |
4532 Assembler::BlockPoolsScope scope(masm_); | 4525 Assembler::BlockPoolsScope scope(masm_); |
4533 Handle<Code> code = | 4526 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), Token::ADD).code(); |
4534 CodeFactory::BinaryOpIC(isolate(), Token::ADD, NO_OVERWRITE).code(); | |
4535 CallIC(code, expr->CountBinOpFeedbackId()); | 4527 CallIC(code, expr->CountBinOpFeedbackId()); |
4536 patch_site.EmitPatchInfo(); | 4528 patch_site.EmitPatchInfo(); |
4537 } | 4529 } |
4538 __ Bind(&done); | 4530 __ Bind(&done); |
4539 | 4531 |
4540 // Store the value returned in x0. | 4532 // Store the value returned in x0. |
4541 switch (assign_type) { | 4533 switch (assign_type) { |
4542 case VARIABLE: | 4534 case VARIABLE: |
4543 if (expr->is_postfix()) { | 4535 if (expr->is_postfix()) { |
4544 { EffectContext context(this); | 4536 { EffectContext context(this); |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5413 return previous_; | 5405 return previous_; |
5414 } | 5406 } |
5415 | 5407 |
5416 | 5408 |
5417 #undef __ | 5409 #undef __ |
5418 | 5410 |
5419 | 5411 |
5420 } } // namespace v8::internal | 5412 } } // namespace v8::internal |
5421 | 5413 |
5422 #endif // V8_TARGET_ARCH_ARM64 | 5414 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |