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/mips/full-codegen-mips.cc

Issue 100023002: MIPS: Refactor BinaryOpIC to be able to use different stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips/lithium-codegen-mips.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 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 __ pop(left); 2312 __ pop(left);
2313 __ mov(a0, result_register()); 2313 __ mov(a0, result_register());
2314 2314
2315 // Perform combined smi check on both operands. 2315 // Perform combined smi check on both operands.
2316 __ Or(scratch1, left, Operand(right)); 2316 __ Or(scratch1, left, Operand(right));
2317 STATIC_ASSERT(kSmiTag == 0); 2317 STATIC_ASSERT(kSmiTag == 0);
2318 JumpPatchSite patch_site(masm_); 2318 JumpPatchSite patch_site(masm_);
2319 patch_site.EmitJumpIfSmi(scratch1, &smi_case); 2319 patch_site.EmitJumpIfSmi(scratch1, &smi_case);
2320 2320
2321 __ bind(&stub_call); 2321 __ bind(&stub_call);
2322 BinaryOpStub stub(op, mode); 2322 BinaryOpICStub stub(op, mode);
2323 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, 2323 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
2324 expr->BinaryOperationFeedbackId()); 2324 expr->BinaryOperationFeedbackId());
2325 patch_site.EmitPatchInfo(); 2325 patch_site.EmitPatchInfo();
2326 __ jmp(&done); 2326 __ jmp(&done);
2327 2327
2328 __ bind(&smi_case); 2328 __ bind(&smi_case);
2329 // Smi case. This code works the same way as the smi-smi case in the type 2329 // Smi case. This code works the same way as the smi-smi case in the type
2330 // recording binary operation stub, see 2330 // recording binary operation stub, see
2331 // BinaryOpStub::GenerateSmiSmiOperation for comments.
2332 switch (op) { 2331 switch (op) {
2333 case Token::SAR: 2332 case Token::SAR:
2334 __ Branch(&stub_call); 2333 __ Branch(&stub_call);
2335 __ GetLeastBitsFromSmi(scratch1, right, 5); 2334 __ GetLeastBitsFromSmi(scratch1, right, 5);
2336 __ srav(right, left, scratch1); 2335 __ srav(right, left, scratch1);
2337 __ And(v0, right, Operand(~kSmiTagMask)); 2336 __ And(v0, right, Operand(~kSmiTagMask));
2338 break; 2337 break;
2339 case Token::SHL: { 2338 case Token::SHL: {
2340 __ Branch(&stub_call); 2339 __ Branch(&stub_call);
2341 __ SmiUntag(scratch1, left); 2340 __ SmiUntag(scratch1, left);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2395 __ bind(&done); 2394 __ bind(&done);
2396 context()->Plug(v0); 2395 context()->Plug(v0);
2397 } 2396 }
2398 2397
2399 2398
2400 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, 2399 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
2401 Token::Value op, 2400 Token::Value op,
2402 OverwriteMode mode) { 2401 OverwriteMode mode) {
2403 __ mov(a0, result_register()); 2402 __ mov(a0, result_register());
2404 __ pop(a1); 2403 __ pop(a1);
2405 BinaryOpStub stub(op, mode); 2404 BinaryOpICStub stub(op, mode);
2406 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2405 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2407 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, 2406 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
2408 expr->BinaryOperationFeedbackId()); 2407 expr->BinaryOperationFeedbackId());
2409 patch_site.EmitPatchInfo(); 2408 patch_site.EmitPatchInfo();
2410 context()->Plug(v0); 2409 context()->Plug(v0);
2411 } 2410 }
2412 2411
2413 2412
2414 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2413 void FullCodeGenerator::EmitAssignment(Expression* expr) {
2415 // Invalid left-hand sides are rewritten by the parser to have a 'throw 2414 // Invalid left-hand sides are rewritten by the parser to have a 'throw
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after
4467 } 4466 }
4468 } 4467 }
4469 4468
4470 __ bind(&stub_call); 4469 __ bind(&stub_call);
4471 __ mov(a1, v0); 4470 __ mov(a1, v0);
4472 __ li(a0, Operand(Smi::FromInt(count_value))); 4471 __ li(a0, Operand(Smi::FromInt(count_value)));
4473 4472
4474 // Record position before stub call. 4473 // Record position before stub call.
4475 SetSourcePosition(expr->position()); 4474 SetSourcePosition(expr->position());
4476 4475
4477 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); 4476 BinaryOpICStub stub(Token::ADD, NO_OVERWRITE);
4478 CallIC(stub.GetCode(isolate()), 4477 CallIC(stub.GetCode(isolate()),
4479 RelocInfo::CODE_TARGET, 4478 RelocInfo::CODE_TARGET,
4480 expr->CountBinOpFeedbackId()); 4479 expr->CountBinOpFeedbackId());
4481 patch_site.EmitPatchInfo(); 4480 patch_site.EmitPatchInfo();
4482 __ bind(&done); 4481 __ bind(&done);
4483 4482
4484 // Store the value returned in v0. 4483 // Store the value returned in v0.
4485 switch (assign_type) { 4484 switch (assign_type) {
4486 case VARIABLE: 4485 case VARIABLE:
4487 if (expr->is_postfix()) { 4486 if (expr->is_postfix()) {
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
4978 Assembler::target_address_at(pc_immediate_load_address)) == 4977 Assembler::target_address_at(pc_immediate_load_address)) ==
4979 reinterpret_cast<uint32_t>( 4978 reinterpret_cast<uint32_t>(
4980 isolate->builtins()->OsrAfterStackCheck()->entry())); 4979 isolate->builtins()->OsrAfterStackCheck()->entry()));
4981 return OSR_AFTER_STACK_CHECK; 4980 return OSR_AFTER_STACK_CHECK;
4982 } 4981 }
4983 4982
4984 4983
4985 } } // namespace v8::internal 4984 } } // namespace v8::internal
4986 4985
4987 #endif // V8_TARGET_ARCH_MIPS 4986 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698