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

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

Issue 1092353002: [strong] Disallow implicit conversions for binary arithmetic operations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback 5 Created 5 years, 8 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
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 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 // rcx to make the shifts easier. 2413 // rcx to make the shifts easier.
2414 Label done, stub_call, smi_case; 2414 Label done, stub_call, smi_case;
2415 __ Pop(rdx); 2415 __ Pop(rdx);
2416 __ movp(rcx, rax); 2416 __ movp(rcx, rax);
2417 __ orp(rax, rdx); 2417 __ orp(rax, rdx);
2418 JumpPatchSite patch_site(masm_); 2418 JumpPatchSite patch_site(masm_);
2419 patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear); 2419 patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear);
2420 2420
2421 __ bind(&stub_call); 2421 __ bind(&stub_call);
2422 __ movp(rax, rcx); 2422 __ movp(rax, rcx);
2423 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2423 Handle<Code> code = CodeFactory::BinaryOpIC(
2424 isolate(), op, language_mode()).code();
2424 CallIC(code, expr->BinaryOperationFeedbackId()); 2425 CallIC(code, expr->BinaryOperationFeedbackId());
2425 patch_site.EmitPatchInfo(); 2426 patch_site.EmitPatchInfo();
2426 __ jmp(&done, Label::kNear); 2427 __ jmp(&done, Label::kNear);
2427 2428
2428 __ bind(&smi_case); 2429 __ bind(&smi_case);
2429 switch (op) { 2430 switch (op) {
2430 case Token::SAR: 2431 case Token::SAR:
2431 __ SmiShiftArithmeticRight(rax, rdx, rcx); 2432 __ SmiShiftArithmeticRight(rax, rdx, rcx);
2432 break; 2433 break;
2433 case Token::SHL: 2434 case Token::SHL:
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2525 // prototype 2526 // prototype
2526 __ CallRuntime(Runtime::kToFastProperties, 1); 2527 __ CallRuntime(Runtime::kToFastProperties, 1);
2527 2528
2528 // constructor 2529 // constructor
2529 __ CallRuntime(Runtime::kToFastProperties, 1); 2530 __ CallRuntime(Runtime::kToFastProperties, 1);
2530 } 2531 }
2531 2532
2532 2533
2533 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 2534 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
2534 __ Pop(rdx); 2535 __ Pop(rdx);
2535 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2536 Handle<Code> code = CodeFactory::BinaryOpIC(
2537 isolate(), op, language_mode()).code();
2536 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2538 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2537 CallIC(code, expr->BinaryOperationFeedbackId()); 2539 CallIC(code, expr->BinaryOperationFeedbackId());
2538 patch_site.EmitPatchInfo(); 2540 patch_site.EmitPatchInfo();
2539 context()->Plug(rax); 2541 context()->Plug(rax);
2540 } 2542 }
2541 2543
2542 2544
2543 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2545 void FullCodeGenerator::EmitAssignment(Expression* expr) {
2544 DCHECK(expr->IsValidReferenceExpression()); 2546 DCHECK(expr->IsValidReferenceExpression());
2545 2547
(...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after
4937 } 4939 }
4938 } 4940 }
4939 4941
4940 // Record position before stub call. 4942 // Record position before stub call.
4941 SetSourcePosition(expr->position()); 4943 SetSourcePosition(expr->position());
4942 4944
4943 // Call stub for +1/-1. 4945 // Call stub for +1/-1.
4944 __ bind(&stub_call); 4946 __ bind(&stub_call);
4945 __ movp(rdx, rax); 4947 __ movp(rdx, rax);
4946 __ Move(rax, Smi::FromInt(1)); 4948 __ Move(rax, Smi::FromInt(1));
4947 Handle<Code> code = 4949 Handle<Code> code = CodeFactory::BinaryOpIC(
4948 CodeFactory::BinaryOpIC(isolate(), expr->binary_op()).code(); 4950 isolate(), expr->binary_op(), language_mode()).code();
4949 CallIC(code, expr->CountBinOpFeedbackId()); 4951 CallIC(code, expr->CountBinOpFeedbackId());
4950 patch_site.EmitPatchInfo(); 4952 patch_site.EmitPatchInfo();
4951 __ bind(&done); 4953 __ bind(&done);
4952 4954
4953 // Store the value returned in rax. 4955 // Store the value returned in rax.
4954 switch (assign_type) { 4956 switch (assign_type) {
4955 case VARIABLE: 4957 case VARIABLE:
4956 if (expr->is_postfix()) { 4958 if (expr->is_postfix()) {
4957 // Perform the assignment as if via '='. 4959 // Perform the assignment as if via '='.
4958 { EffectContext context(this); 4960 { EffectContext context(this);
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
5417 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5419 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5418 Assembler::target_address_at(call_target_address, 5420 Assembler::target_address_at(call_target_address,
5419 unoptimized_code)); 5421 unoptimized_code));
5420 return OSR_AFTER_STACK_CHECK; 5422 return OSR_AFTER_STACK_CHECK;
5421 } 5423 }
5422 5424
5423 5425
5424 } } // namespace v8::internal 5426 } } // namespace v8::internal
5425 5427
5426 #endif // V8_TARGET_ARCH_X64 5428 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698