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

Side by Side Diff: src/x64/full-codegen-x64.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 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 // rcx to make the shifts easier. 2261 // rcx to make the shifts easier.
2262 Label done, stub_call, smi_case; 2262 Label done, stub_call, smi_case;
2263 __ pop(rdx); 2263 __ pop(rdx);
2264 __ movq(rcx, rax); 2264 __ movq(rcx, rax);
2265 __ or_(rax, rdx); 2265 __ or_(rax, rdx);
2266 JumpPatchSite patch_site(masm_); 2266 JumpPatchSite patch_site(masm_);
2267 patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear); 2267 patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear);
2268 2268
2269 __ bind(&stub_call); 2269 __ bind(&stub_call);
2270 __ movq(rax, rcx); 2270 __ movq(rax, rcx);
2271 BinaryOpStub stub(op, mode); 2271 BinaryOpICStub stub(op, mode);
2272 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, 2272 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
2273 expr->BinaryOperationFeedbackId()); 2273 expr->BinaryOperationFeedbackId());
2274 patch_site.EmitPatchInfo(); 2274 patch_site.EmitPatchInfo();
2275 __ jmp(&done, Label::kNear); 2275 __ jmp(&done, Label::kNear);
2276 2276
2277 __ bind(&smi_case); 2277 __ bind(&smi_case);
2278 switch (op) { 2278 switch (op) {
2279 case Token::SAR: 2279 case Token::SAR:
2280 __ SmiShiftArithmeticRight(rax, rdx, rcx); 2280 __ SmiShiftArithmeticRight(rax, rdx, rcx);
2281 break; 2281 break;
(...skipping 28 matching lines...) Expand all
2310 2310
2311 __ bind(&done); 2311 __ bind(&done);
2312 context()->Plug(rax); 2312 context()->Plug(rax);
2313 } 2313 }
2314 2314
2315 2315
2316 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, 2316 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
2317 Token::Value op, 2317 Token::Value op,
2318 OverwriteMode mode) { 2318 OverwriteMode mode) {
2319 __ pop(rdx); 2319 __ pop(rdx);
2320 BinaryOpStub stub(op, mode); 2320 BinaryOpICStub stub(op, mode);
2321 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2321 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2322 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, 2322 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
2323 expr->BinaryOperationFeedbackId()); 2323 expr->BinaryOperationFeedbackId());
2324 patch_site.EmitPatchInfo(); 2324 patch_site.EmitPatchInfo();
2325 context()->Plug(rax); 2325 context()->Plug(rax);
2326 } 2326 }
2327 2327
2328 2328
2329 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2329 void FullCodeGenerator::EmitAssignment(Expression* expr) {
2330 // Invalid left-hand sides are rewritten by the parser to have a 'throw 2330 // Invalid left-hand sides are rewritten by the parser to have a 'throw
(...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after
4398 } 4398 }
4399 } 4399 }
4400 4400
4401 // Record position before stub call. 4401 // Record position before stub call.
4402 SetSourcePosition(expr->position()); 4402 SetSourcePosition(expr->position());
4403 4403
4404 // Call stub for +1/-1. 4404 // Call stub for +1/-1.
4405 __ bind(&stub_call); 4405 __ bind(&stub_call);
4406 __ movq(rdx, rax); 4406 __ movq(rdx, rax);
4407 __ Move(rax, Smi::FromInt(1)); 4407 __ Move(rax, Smi::FromInt(1));
4408 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); 4408 BinaryOpICStub stub(expr->binary_op(), NO_OVERWRITE);
4409 CallIC(stub.GetCode(isolate()), 4409 CallIC(stub.GetCode(isolate()),
4410 RelocInfo::CODE_TARGET, 4410 RelocInfo::CODE_TARGET,
4411 expr->CountBinOpFeedbackId()); 4411 expr->CountBinOpFeedbackId());
4412 patch_site.EmitPatchInfo(); 4412 patch_site.EmitPatchInfo();
4413 __ bind(&done); 4413 __ bind(&done);
4414 4414
4415 // Store the value returned in rax. 4415 // Store the value returned in rax.
4416 switch (assign_type) { 4416 switch (assign_type) {
4417 case VARIABLE: 4417 case VARIABLE:
4418 if (expr->is_postfix()) { 4418 if (expr->is_postfix()) {
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
4906 4906
4907 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4907 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4908 Assembler::target_address_at(call_target_address)); 4908 Assembler::target_address_at(call_target_address));
4909 return OSR_AFTER_STACK_CHECK; 4909 return OSR_AFTER_STACK_CHECK;
4910 } 4910 }
4911 4911
4912 4912
4913 } } // namespace v8::internal 4913 } } // namespace v8::internal
4914 4914
4915 #endif // V8_TARGET_ARCH_X64 4915 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/log.cc ('K') | « src/x64/code-stubs-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698