Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 1216463003: [strong] Implement strong mode semantics for the count operation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback + eliminate runtime check Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-internal.cc ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_X64 7 #if V8_TARGET_ARCH_X64
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 4959 matching lines...) Expand 10 before | Expand all | Expand 10 after
4970 mode.Add(PRESERVE_SOURCE_REGISTER); 4970 mode.Add(PRESERVE_SOURCE_REGISTER);
4971 mode.Add(BAILOUT_ON_NO_OVERFLOW); 4971 mode.Add(BAILOUT_ON_NO_OVERFLOW);
4972 if (expr->op() == Token::INC) { 4972 if (expr->op() == Token::INC) {
4973 __ SmiAddConstant(rax, rax, Smi::FromInt(1), mode, &done, Label::kNear); 4973 __ SmiAddConstant(rax, rax, Smi::FromInt(1), mode, &done, Label::kNear);
4974 } else { 4974 } else {
4975 __ SmiSubConstant(rax, rax, Smi::FromInt(1), mode, &done, Label::kNear); 4975 __ SmiSubConstant(rax, rax, Smi::FromInt(1), mode, &done, Label::kNear);
4976 } 4976 }
4977 __ jmp(&stub_call, Label::kNear); 4977 __ jmp(&stub_call, Label::kNear);
4978 __ bind(&slow); 4978 __ bind(&slow);
4979 } 4979 }
4980 4980 if (!is_strong(language_mode())) {
4981 ToNumberStub convert_stub(isolate()); 4981 ToNumberStub convert_stub(isolate());
4982 __ CallStub(&convert_stub); 4982 __ CallStub(&convert_stub);
4983 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); 4983 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG);
4984 }
4984 4985
4985 // Save result for postfix expressions. 4986 // Save result for postfix expressions.
4986 if (expr->is_postfix()) { 4987 if (expr->is_postfix()) {
4987 if (!context()->IsEffect()) { 4988 if (!context()->IsEffect()) {
4988 // Save the result on the stack. If we have a named or keyed property 4989 // Save the result on the stack. If we have a named or keyed property
4989 // we store the result under the receiver that is currently on top 4990 // we store the result under the receiver that is currently on top
4990 // of the stack. 4991 // of the stack.
4991 switch (assign_type) { 4992 switch (assign_type) {
4992 case VARIABLE: 4993 case VARIABLE:
4993 __ Push(rax); 4994 __ Push(rax);
(...skipping 20 matching lines...) Expand all
5014 // Call stub for +1/-1. 5015 // Call stub for +1/-1.
5015 __ bind(&stub_call); 5016 __ bind(&stub_call);
5016 __ movp(rdx, rax); 5017 __ movp(rdx, rax);
5017 __ Move(rax, Smi::FromInt(1)); 5018 __ Move(rax, Smi::FromInt(1));
5018 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), 5019 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(),
5019 strength(language_mode())).code(); 5020 strength(language_mode())).code();
5020 CallIC(code, expr->CountBinOpFeedbackId()); 5021 CallIC(code, expr->CountBinOpFeedbackId());
5021 patch_site.EmitPatchInfo(); 5022 patch_site.EmitPatchInfo();
5022 __ bind(&done); 5023 __ bind(&done);
5023 5024
5025 if (is_strong(language_mode())) {
5026 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG);
5027 }
5024 // Store the value returned in rax. 5028 // Store the value returned in rax.
5025 switch (assign_type) { 5029 switch (assign_type) {
5026 case VARIABLE: 5030 case VARIABLE:
5027 if (expr->is_postfix()) { 5031 if (expr->is_postfix()) {
5028 // Perform the assignment as if via '='. 5032 // Perform the assignment as if via '='.
5029 { EffectContext context(this); 5033 { EffectContext context(this);
5030 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 5034 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
5031 Token::ASSIGN, expr->CountSlot()); 5035 Token::ASSIGN, expr->CountSlot());
5032 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 5036 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
5033 context.Plug(rax); 5037 context.Plug(rax);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
5515 Assembler::target_address_at(call_target_address, 5519 Assembler::target_address_at(call_target_address,
5516 unoptimized_code)); 5520 unoptimized_code));
5517 return OSR_AFTER_STACK_CHECK; 5521 return OSR_AFTER_STACK_CHECK;
5518 } 5522 }
5519 5523
5520 5524
5521 } // namespace internal 5525 } // namespace internal
5522 } // namespace v8 5526 } // namespace v8
5523 5527
5524 #endif // V8_TARGET_ARCH_X64 5528 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime/runtime-internal.cc ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698