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

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

Issue 23537038: Remove override mode from BinaryOpStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 EmitKeyedPropertyLoad(property); 1888 EmitKeyedPropertyLoad(property);
1889 PrepareForBailoutForId(property->LoadId(), TOS_REG); 1889 PrepareForBailoutForId(property->LoadId(), TOS_REG);
1890 break; 1890 break;
1891 } 1891 }
1892 } 1892 }
1893 1893
1894 Token::Value op = expr->binary_op(); 1894 Token::Value op = expr->binary_op();
1895 __ push(eax); // Left operand goes on the stack. 1895 __ push(eax); // Left operand goes on the stack.
1896 VisitForAccumulatorValue(expr->value()); 1896 VisitForAccumulatorValue(expr->value());
1897 1897
1898 OverwriteMode mode = expr->value()->ResultOverwriteAllowed()
1899 ? OVERWRITE_RIGHT
1900 : NO_OVERWRITE;
1901 SetSourcePosition(expr->position() + 1); 1898 SetSourcePosition(expr->position() + 1);
1902 if (ShouldInlineSmiCase(op)) { 1899 if (ShouldInlineSmiCase(op)) {
1903 EmitInlineSmiBinaryOp(expr->binary_operation(), 1900 EmitInlineSmiBinaryOp(expr->binary_operation(),
1904 op, 1901 op,
1905 mode,
1906 expr->target(), 1902 expr->target(),
1907 expr->value()); 1903 expr->value());
1908 } else { 1904 } else {
1909 EmitBinaryOp(expr->binary_operation(), op, mode); 1905 EmitBinaryOp(expr->binary_operation(), op);
1910 } 1906 }
1911 1907
1912 // Deoptimization point in case the binary operation may have side effects. 1908 // Deoptimization point in case the binary operation may have side effects.
1913 PrepareForBailout(expr->binary_operation(), TOS_REG); 1909 PrepareForBailout(expr->binary_operation(), TOS_REG);
1914 } else { 1910 } else {
1915 VisitForAccumulatorValue(expr->value()); 1911 VisitForAccumulatorValue(expr->value());
1916 } 1912 }
1917 1913
1918 // Record source position before possible IC call. 1914 // Record source position before possible IC call.
1919 SetSourcePosition(expr->position()); 1915 SetSourcePosition(expr->position());
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2226 2222
2227 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2223 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2228 SetSourcePosition(prop->position()); 2224 SetSourcePosition(prop->position());
2229 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); 2225 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
2230 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); 2226 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId());
2231 } 2227 }
2232 2228
2233 2229
2234 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, 2230 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
2235 Token::Value op, 2231 Token::Value op,
2236 OverwriteMode mode,
2237 Expression* left, 2232 Expression* left,
2238 Expression* right) { 2233 Expression* right) {
2239 // Do combined smi check of the operands. Left operand is on the 2234 // Do combined smi check of the operands. Left operand is on the
2240 // stack. Right operand is in eax. 2235 // stack. Right operand is in eax.
2241 Label smi_case, done, stub_call; 2236 Label smi_case, done, stub_call;
2242 __ pop(edx); 2237 __ pop(edx);
2243 __ mov(ecx, eax); 2238 __ mov(ecx, eax);
2244 __ or_(eax, edx); 2239 __ or_(eax, edx);
2245 JumpPatchSite patch_site(masm_); 2240 JumpPatchSite patch_site(masm_);
2246 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); 2241 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear);
2247 2242
2248 __ bind(&stub_call); 2243 __ bind(&stub_call);
2249 __ mov(eax, ecx); 2244 __ mov(eax, ecx);
2250 BinaryOpStub stub(op, mode); 2245 BinaryOpStub stub(op);
2251 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, 2246 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
2252 expr->BinaryOperationFeedbackId()); 2247 expr->BinaryOperationFeedbackId());
2253 patch_site.EmitPatchInfo(); 2248 patch_site.EmitPatchInfo();
2254 __ jmp(&done, Label::kNear); 2249 __ jmp(&done, Label::kNear);
2255 2250
2256 // Smi case. 2251 // Smi case.
2257 __ bind(&smi_case); 2252 __ bind(&smi_case);
2258 __ mov(eax, edx); // Copy left operand in case of a stub call. 2253 __ mov(eax, edx); // Copy left operand in case of a stub call.
2259 2254
2260 switch (op) { 2255 switch (op) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 default: 2317 default:
2323 UNREACHABLE(); 2318 UNREACHABLE();
2324 } 2319 }
2325 2320
2326 __ bind(&done); 2321 __ bind(&done);
2327 context()->Plug(eax); 2322 context()->Plug(eax);
2328 } 2323 }
2329 2324
2330 2325
2331 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, 2326 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
2332 Token::Value op, 2327 Token::Value op) {
2333 OverwriteMode mode) {
2334 __ pop(edx); 2328 __ pop(edx);
2335 BinaryOpStub stub(op, mode); 2329 BinaryOpStub stub(op);
2336 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2330 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2337 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, 2331 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
2338 expr->BinaryOperationFeedbackId()); 2332 expr->BinaryOperationFeedbackId());
2339 patch_site.EmitPatchInfo(); 2333 patch_site.EmitPatchInfo();
2340 context()->Plug(eax); 2334 context()->Plug(eax);
2341 } 2335 }
2342 2336
2343 2337
2344 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2338 void FullCodeGenerator::EmitAssignment(Expression* expr) {
2345 // Invalid left-hand sides are rewritten by the parser to have a 'throw 2339 // Invalid left-hand sides are rewritten by the parser to have a 'throw
(...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after
4460 __ add(eax, Immediate(Smi::FromInt(1))); 4454 __ add(eax, Immediate(Smi::FromInt(1)));
4461 } 4455 }
4462 } 4456 }
4463 4457
4464 // Record position before stub call. 4458 // Record position before stub call.
4465 SetSourcePosition(expr->position()); 4459 SetSourcePosition(expr->position());
4466 4460
4467 // Call stub for +1/-1. 4461 // Call stub for +1/-1.
4468 __ mov(edx, eax); 4462 __ mov(edx, eax);
4469 __ mov(eax, Immediate(Smi::FromInt(1))); 4463 __ mov(eax, Immediate(Smi::FromInt(1)));
4470 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); 4464 BinaryOpStub stub(expr->binary_op());
4471 CallIC(stub.GetCode(isolate()), 4465 CallIC(stub.GetCode(isolate()),
4472 RelocInfo::CODE_TARGET, 4466 RelocInfo::CODE_TARGET,
4473 expr->CountBinOpFeedbackId()); 4467 expr->CountBinOpFeedbackId());
4474 patch_site.EmitPatchInfo(); 4468 patch_site.EmitPatchInfo();
4475 __ bind(&done); 4469 __ bind(&done);
4476 4470
4477 // Store the value returned in eax. 4471 // Store the value returned in eax.
4478 switch (assign_type) { 4472 switch (assign_type) {
4479 case VARIABLE: 4473 case VARIABLE:
4480 if (expr->is_postfix()) { 4474 if (expr->is_postfix()) {
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
4893 *stack_depth = 0; 4887 *stack_depth = 0;
4894 *context_length = 0; 4888 *context_length = 0;
4895 return previous_; 4889 return previous_;
4896 } 4890 }
4897 4891
4898 #undef __ 4892 #undef __
4899 4893
4900 } } // namespace v8::internal 4894 } } // namespace v8::internal
4901 4895
4902 #endif // V8_TARGET_ARCH_IA32 4896 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698