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

Side by Side Diff: src/ia32/full-codegen-ia32.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_IA32 7 #if V8_TARGET_ARCH_IA32
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 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 // stack. Right operand is in eax. 2380 // stack. Right operand is in eax.
2381 Label smi_case, done, stub_call; 2381 Label smi_case, done, stub_call;
2382 __ pop(edx); 2382 __ pop(edx);
2383 __ mov(ecx, eax); 2383 __ mov(ecx, eax);
2384 __ or_(eax, edx); 2384 __ or_(eax, edx);
2385 JumpPatchSite patch_site(masm_); 2385 JumpPatchSite patch_site(masm_);
2386 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); 2386 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear);
2387 2387
2388 __ bind(&stub_call); 2388 __ bind(&stub_call);
2389 __ mov(eax, ecx); 2389 __ mov(eax, ecx);
2390 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2390 Handle<Code> code = CodeFactory::BinaryOpIC(
2391 isolate(), op, language_mode()).code();
2391 CallIC(code, expr->BinaryOperationFeedbackId()); 2392 CallIC(code, expr->BinaryOperationFeedbackId());
2392 patch_site.EmitPatchInfo(); 2393 patch_site.EmitPatchInfo();
2393 __ jmp(&done, Label::kNear); 2394 __ jmp(&done, Label::kNear);
2394 2395
2395 // Smi case. 2396 // Smi case.
2396 __ bind(&smi_case); 2397 __ bind(&smi_case);
2397 __ mov(eax, edx); // Copy left operand in case of a stub call. 2398 __ mov(eax, edx); // Copy left operand in case of a stub call.
2398 2399
2399 switch (op) { 2400 switch (op) {
2400 case Token::SAR: 2401 case Token::SAR:
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2524 // prototype 2525 // prototype
2525 __ CallRuntime(Runtime::kToFastProperties, 1); 2526 __ CallRuntime(Runtime::kToFastProperties, 1);
2526 2527
2527 // constructor 2528 // constructor
2528 __ CallRuntime(Runtime::kToFastProperties, 1); 2529 __ CallRuntime(Runtime::kToFastProperties, 1);
2529 } 2530 }
2530 2531
2531 2532
2532 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 2533 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
2533 __ pop(edx); 2534 __ pop(edx);
2534 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2535 Handle<Code> code = CodeFactory::BinaryOpIC(
2536 isolate(), op, language_mode()).code();
2535 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2537 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2536 CallIC(code, expr->BinaryOperationFeedbackId()); 2538 CallIC(code, expr->BinaryOperationFeedbackId());
2537 patch_site.EmitPatchInfo(); 2539 patch_site.EmitPatchInfo();
2538 context()->Plug(eax); 2540 context()->Plug(eax);
2539 } 2541 }
2540 2542
2541 2543
2542 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2544 void FullCodeGenerator::EmitAssignment(Expression* expr) {
2543 DCHECK(expr->IsValidReferenceExpression()); 2545 DCHECK(expr->IsValidReferenceExpression());
2544 2546
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after
4918 } 4920 }
4919 4921
4920 // Record position before stub call. 4922 // Record position before stub call.
4921 SetSourcePosition(expr->position()); 4923 SetSourcePosition(expr->position());
4922 4924
4923 // Call stub for +1/-1. 4925 // Call stub for +1/-1.
4924 __ bind(&stub_call); 4926 __ bind(&stub_call);
4925 __ mov(edx, eax); 4927 __ mov(edx, eax);
4926 __ mov(eax, Immediate(Smi::FromInt(1))); 4928 __ mov(eax, Immediate(Smi::FromInt(1)));
4927 Handle<Code> code = 4929 Handle<Code> code =
4928 CodeFactory::BinaryOpIC(isolate(), expr->binary_op()).code(); 4930 CodeFactory::BinaryOpIC(
4931 isolate(), expr->binary_op(), language_mode()).code();
4929 CallIC(code, expr->CountBinOpFeedbackId()); 4932 CallIC(code, expr->CountBinOpFeedbackId());
4930 patch_site.EmitPatchInfo(); 4933 patch_site.EmitPatchInfo();
4931 __ bind(&done); 4934 __ bind(&done);
4932 4935
4933 // Store the value returned in eax. 4936 // Store the value returned in eax.
4934 switch (assign_type) { 4937 switch (assign_type) {
4935 case VARIABLE: 4938 case VARIABLE:
4936 if (expr->is_postfix()) { 4939 if (expr->is_postfix()) {
4937 // Perform the assignment as if via '='. 4940 // Perform the assignment as if via '='.
4938 { EffectContext context(this); 4941 { EffectContext context(this);
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
5396 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5399 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5397 Assembler::target_address_at(call_target_address, 5400 Assembler::target_address_at(call_target_address,
5398 unoptimized_code)); 5401 unoptimized_code));
5399 return OSR_AFTER_STACK_CHECK; 5402 return OSR_AFTER_STACK_CHECK;
5400 } 5403 }
5401 5404
5402 5405
5403 } } // namespace v8::internal 5406 } } // namespace v8::internal
5404 5407
5405 #endif // V8_TARGET_ARCH_IA32 5408 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | src/ic/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698