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

Side by Side Diff: src/arm/full-codegen-arm.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 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 Register right = r0; 2291 Register right = r0;
2292 __ pop(left); 2292 __ pop(left);
2293 2293
2294 // Perform combined smi check on both operands. 2294 // Perform combined smi check on both operands.
2295 __ orr(scratch1, left, Operand(right)); 2295 __ orr(scratch1, left, Operand(right));
2296 STATIC_ASSERT(kSmiTag == 0); 2296 STATIC_ASSERT(kSmiTag == 0);
2297 JumpPatchSite patch_site(masm_); 2297 JumpPatchSite patch_site(masm_);
2298 patch_site.EmitJumpIfSmi(scratch1, &smi_case); 2298 patch_site.EmitJumpIfSmi(scratch1, &smi_case);
2299 2299
2300 __ bind(&stub_call); 2300 __ bind(&stub_call);
2301 BinaryOpStub stub(op, mode); 2301 BinaryOpICStub stub(op, mode);
2302 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, 2302 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
2303 expr->BinaryOperationFeedbackId()); 2303 expr->BinaryOperationFeedbackId());
2304 patch_site.EmitPatchInfo(); 2304 patch_site.EmitPatchInfo();
2305 __ jmp(&done); 2305 __ jmp(&done);
2306 2306
2307 __ bind(&smi_case); 2307 __ bind(&smi_case);
2308 // Smi case. This code works the same way as the smi-smi case in the type 2308 // Smi case. This code works the same way as the smi-smi case in the type
2309 // recording binary operation stub, see 2309 // recording binary operation stub, see
2310 // BinaryOpStub::GenerateSmiSmiOperation for comments.
2311 switch (op) { 2310 switch (op) {
2312 case Token::SAR: 2311 case Token::SAR:
2313 __ GetLeastBitsFromSmi(scratch1, right, 5); 2312 __ GetLeastBitsFromSmi(scratch1, right, 5);
2314 __ mov(right, Operand(left, ASR, scratch1)); 2313 __ mov(right, Operand(left, ASR, scratch1));
2315 __ bic(right, right, Operand(kSmiTagMask)); 2314 __ bic(right, right, Operand(kSmiTagMask));
2316 break; 2315 break;
2317 case Token::SHL: { 2316 case Token::SHL: {
2318 __ SmiUntag(scratch1, left); 2317 __ SmiUntag(scratch1, left);
2319 __ GetLeastBitsFromSmi(scratch2, right, 5); 2318 __ GetLeastBitsFromSmi(scratch2, right, 5);
2320 __ mov(scratch1, Operand(scratch1, LSL, scratch2)); 2319 __ mov(scratch1, Operand(scratch1, LSL, scratch2));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 2368
2370 __ bind(&done); 2369 __ bind(&done);
2371 context()->Plug(r0); 2370 context()->Plug(r0);
2372 } 2371 }
2373 2372
2374 2373
2375 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, 2374 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
2376 Token::Value op, 2375 Token::Value op,
2377 OverwriteMode mode) { 2376 OverwriteMode mode) {
2378 __ pop(r1); 2377 __ pop(r1);
2379 BinaryOpStub stub(op, mode); 2378 BinaryOpICStub stub(op, mode);
2380 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2379 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2381 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, 2380 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
2382 expr->BinaryOperationFeedbackId()); 2381 expr->BinaryOperationFeedbackId());
2383 patch_site.EmitPatchInfo(); 2382 patch_site.EmitPatchInfo();
2384 context()->Plug(r0); 2383 context()->Plug(r0);
2385 } 2384 }
2386 2385
2387 2386
2388 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2387 void FullCodeGenerator::EmitAssignment(Expression* expr) {
2389 // Invalid left-hand sides are rewritten by the parser to have a 'throw 2388 // Invalid left-hand sides are rewritten by the parser to have a 'throw
(...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after
4409 } 4408 }
4410 4409
4411 4410
4412 __ bind(&stub_call); 4411 __ bind(&stub_call);
4413 __ mov(r1, r0); 4412 __ mov(r1, r0);
4414 __ mov(r0, Operand(Smi::FromInt(count_value))); 4413 __ mov(r0, Operand(Smi::FromInt(count_value)));
4415 4414
4416 // Record position before stub call. 4415 // Record position before stub call.
4417 SetSourcePosition(expr->position()); 4416 SetSourcePosition(expr->position());
4418 4417
4419 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); 4418 BinaryOpICStub stub(Token::ADD, NO_OVERWRITE);
4420 CallIC(stub.GetCode(isolate()), 4419 CallIC(stub.GetCode(isolate()),
4421 RelocInfo::CODE_TARGET, 4420 RelocInfo::CODE_TARGET,
4422 expr->CountBinOpFeedbackId()); 4421 expr->CountBinOpFeedbackId());
4423 patch_site.EmitPatchInfo(); 4422 patch_site.EmitPatchInfo();
4424 __ bind(&done); 4423 __ bind(&done);
4425 4424
4426 // Store the value returned in r0. 4425 // Store the value returned in r0.
4427 switch (assign_type) { 4426 switch (assign_type) {
4428 case VARIABLE: 4427 case VARIABLE:
4429 if (expr->is_postfix()) { 4428 if (expr->is_postfix()) {
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
4929 ASSERT(Memory::uint32_at(interrupt_address_pointer) == 4928 ASSERT(Memory::uint32_at(interrupt_address_pointer) ==
4930 reinterpret_cast<uint32_t>( 4929 reinterpret_cast<uint32_t>(
4931 isolate->builtins()->OsrAfterStackCheck()->entry())); 4930 isolate->builtins()->OsrAfterStackCheck()->entry()));
4932 return OSR_AFTER_STACK_CHECK; 4931 return OSR_AFTER_STACK_CHECK;
4933 } 4932 }
4934 4933
4935 4934
4936 } } // namespace v8::internal 4935 } } // namespace v8::internal
4937 4936
4938 #endif // V8_TARGET_ARCH_ARM 4937 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/lithium-codegen-arm.cc » ('j') | src/log.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698