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

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

Issue 97543002: Refactor BinaryOpIC to be able to use different stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years 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
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 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 // stack. Right operand is in eax. 2238 // stack. Right operand is in eax.
2239 Label smi_case, done, stub_call; 2239 Label smi_case, done, stub_call;
2240 __ pop(edx); 2240 __ pop(edx);
2241 __ mov(ecx, eax); 2241 __ mov(ecx, eax);
2242 __ or_(eax, edx); 2242 __ or_(eax, edx);
2243 JumpPatchSite patch_site(masm_); 2243 JumpPatchSite patch_site(masm_);
2244 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); 2244 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear);
2245 2245
2246 __ bind(&stub_call); 2246 __ bind(&stub_call);
2247 __ mov(eax, ecx); 2247 __ mov(eax, ecx);
2248 BinaryOpStub stub(op, mode); 2248 BinaryOpICStub stub(op, mode);
2249 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, 2249 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
2250 expr->BinaryOperationFeedbackId()); 2250 expr->BinaryOperationFeedbackId());
2251 patch_site.EmitPatchInfo(); 2251 patch_site.EmitPatchInfo();
2252 __ jmp(&done, Label::kNear); 2252 __ jmp(&done, Label::kNear);
2253 2253
2254 // Smi case. 2254 // Smi case.
2255 __ bind(&smi_case); 2255 __ bind(&smi_case);
2256 __ mov(eax, edx); // Copy left operand in case of a stub call. 2256 __ mov(eax, edx); // Copy left operand in case of a stub call.
2257 2257
2258 switch (op) { 2258 switch (op) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 2323
2324 __ bind(&done); 2324 __ bind(&done);
2325 context()->Plug(eax); 2325 context()->Plug(eax);
2326 } 2326 }
2327 2327
2328 2328
2329 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, 2329 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
2330 Token::Value op, 2330 Token::Value op,
2331 OverwriteMode mode) { 2331 OverwriteMode mode) {
2332 __ pop(edx); 2332 __ pop(edx);
2333 BinaryOpStub stub(op, mode); 2333 BinaryOpICStub stub(op, mode);
2334 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2334 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2335 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, 2335 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
2336 expr->BinaryOperationFeedbackId()); 2336 expr->BinaryOperationFeedbackId());
2337 patch_site.EmitPatchInfo(); 2337 patch_site.EmitPatchInfo();
2338 context()->Plug(eax); 2338 context()->Plug(eax);
2339 } 2339 }
2340 2340
2341 2341
2342 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2342 void FullCodeGenerator::EmitAssignment(Expression* expr) {
2343 // Invalid left-hand sides are rewritten by the parser to have a 'throw 2343 // Invalid left-hand sides are rewritten by the parser to have a 'throw
(...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after
4407 } 4407 }
4408 } 4408 }
4409 4409
4410 // Record position before stub call. 4410 // Record position before stub call.
4411 SetSourcePosition(expr->position()); 4411 SetSourcePosition(expr->position());
4412 4412
4413 // Call stub for +1/-1. 4413 // Call stub for +1/-1.
4414 __ bind(&stub_call); 4414 __ bind(&stub_call);
4415 __ mov(edx, eax); 4415 __ mov(edx, eax);
4416 __ mov(eax, Immediate(Smi::FromInt(1))); 4416 __ mov(eax, Immediate(Smi::FromInt(1)));
4417 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); 4417 BinaryOpICStub stub(expr->binary_op(), NO_OVERWRITE);
4418 CallIC(stub.GetCode(isolate()), 4418 CallIC(stub.GetCode(isolate()),
4419 RelocInfo::CODE_TARGET, 4419 RelocInfo::CODE_TARGET,
4420 expr->CountBinOpFeedbackId()); 4420 expr->CountBinOpFeedbackId());
4421 patch_site.EmitPatchInfo(); 4421 patch_site.EmitPatchInfo();
4422 __ bind(&done); 4422 __ bind(&done);
4423 4423
4424 // Store the value returned in eax. 4424 // Store the value returned in eax.
4425 switch (assign_type) { 4425 switch (assign_type) {
4426 case VARIABLE: 4426 case VARIABLE:
4427 if (expr->is_postfix()) { 4427 if (expr->is_postfix()) {
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
4913 4913
4914 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4914 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4915 Assembler::target_address_at(call_target_address)); 4915 Assembler::target_address_at(call_target_address));
4916 return OSR_AFTER_STACK_CHECK; 4916 return OSR_AFTER_STACK_CHECK;
4917 } 4917 }
4918 4918
4919 4919
4920 } } // namespace v8::internal 4920 } } // namespace v8::internal
4921 4921
4922 #endif // V8_TARGET_ARCH_IA32 4922 #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') | src/log.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698