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

Side by Side Diff: src/x87/full-codegen-x87.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_X87 7 #if V8_TARGET_ARCH_X87
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 2356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2367 // stack. Right operand is in eax. 2367 // stack. Right operand is in eax.
2368 Label smi_case, done, stub_call; 2368 Label smi_case, done, stub_call;
2369 __ pop(edx); 2369 __ pop(edx);
2370 __ mov(ecx, eax); 2370 __ mov(ecx, eax);
2371 __ or_(eax, edx); 2371 __ or_(eax, edx);
2372 JumpPatchSite patch_site(masm_); 2372 JumpPatchSite patch_site(masm_);
2373 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); 2373 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear);
2374 2374
2375 __ bind(&stub_call); 2375 __ bind(&stub_call);
2376 __ mov(eax, ecx); 2376 __ mov(eax, ecx);
2377 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2377 Handle<Code> code = CodeFactory::BinaryOpIC(
2378 isolate(), op, language_mode()).code();
2378 CallIC(code, expr->BinaryOperationFeedbackId()); 2379 CallIC(code, expr->BinaryOperationFeedbackId());
2379 patch_site.EmitPatchInfo(); 2380 patch_site.EmitPatchInfo();
2380 __ jmp(&done, Label::kNear); 2381 __ jmp(&done, Label::kNear);
2381 2382
2382 // Smi case. 2383 // Smi case.
2383 __ bind(&smi_case); 2384 __ bind(&smi_case);
2384 __ mov(eax, edx); // Copy left operand in case of a stub call. 2385 __ mov(eax, edx); // Copy left operand in case of a stub call.
2385 2386
2386 switch (op) { 2387 switch (op) {
2387 case Token::SAR: 2388 case Token::SAR:
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 // prototype 2512 // prototype
2512 __ CallRuntime(Runtime::kToFastProperties, 1); 2513 __ CallRuntime(Runtime::kToFastProperties, 1);
2513 2514
2514 // constructor 2515 // constructor
2515 __ CallRuntime(Runtime::kToFastProperties, 1); 2516 __ CallRuntime(Runtime::kToFastProperties, 1);
2516 } 2517 }
2517 2518
2518 2519
2519 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 2520 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
2520 __ pop(edx); 2521 __ pop(edx);
2521 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2522 Handle<Code> code = CodeFactory::BinaryOpIC(
2523 isolate(), op, language_mode()).code();
2522 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2524 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2523 CallIC(code, expr->BinaryOperationFeedbackId()); 2525 CallIC(code, expr->BinaryOperationFeedbackId());
2524 patch_site.EmitPatchInfo(); 2526 patch_site.EmitPatchInfo();
2525 context()->Plug(eax); 2527 context()->Plug(eax);
2526 } 2528 }
2527 2529
2528 2530
2529 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2531 void FullCodeGenerator::EmitAssignment(Expression* expr) {
2530 DCHECK(expr->IsValidReferenceExpression()); 2532 DCHECK(expr->IsValidReferenceExpression());
2531 2533
(...skipping 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after
4904 } 4906 }
4905 4907
4906 // Record position before stub call. 4908 // Record position before stub call.
4907 SetSourcePosition(expr->position()); 4909 SetSourcePosition(expr->position());
4908 4910
4909 // Call stub for +1/-1. 4911 // Call stub for +1/-1.
4910 __ bind(&stub_call); 4912 __ bind(&stub_call);
4911 __ mov(edx, eax); 4913 __ mov(edx, eax);
4912 __ mov(eax, Immediate(Smi::FromInt(1))); 4914 __ mov(eax, Immediate(Smi::FromInt(1)));
4913 Handle<Code> code = 4915 Handle<Code> code =
4914 CodeFactory::BinaryOpIC(isolate(), expr->binary_op()).code(); 4916 CodeFactory::BinaryOpIC(
4917 isolate(), expr->binary_op(), language_mode()).code();
4915 CallIC(code, expr->CountBinOpFeedbackId()); 4918 CallIC(code, expr->CountBinOpFeedbackId());
4916 patch_site.EmitPatchInfo(); 4919 patch_site.EmitPatchInfo();
4917 __ bind(&done); 4920 __ bind(&done);
4918 4921
4919 // Store the value returned in eax. 4922 // Store the value returned in eax.
4920 switch (assign_type) { 4923 switch (assign_type) {
4921 case VARIABLE: 4924 case VARIABLE:
4922 if (expr->is_postfix()) { 4925 if (expr->is_postfix()) {
4923 // Perform the assignment as if via '='. 4926 // Perform the assignment as if via '='.
4924 { EffectContext context(this); 4927 { EffectContext context(this);
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
5382 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5385 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5383 Assembler::target_address_at(call_target_address, 5386 Assembler::target_address_at(call_target_address,
5384 unoptimized_code)); 5387 unoptimized_code));
5385 return OSR_AFTER_STACK_CHECK; 5388 return OSR_AFTER_STACK_CHECK;
5386 } 5389 }
5387 5390
5388 5391
5389 } } // namespace v8::internal 5392 } } // namespace v8::internal
5390 5393
5391 #endif // V8_TARGET_ARCH_X87 5394 #endif // V8_TARGET_ARCH_X87
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698