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/arm/lithium-codegen-arm.cc

Issue 13728002: Add an IC for CompareNil operations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix SunSpider regression Created 7 years, 8 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/arm/lithium-arm.cc ('k') | src/ast.h » ('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 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after
2426 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) { 2426 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) {
2427 Register left = ToRegister(instr->left()); 2427 Register left = ToRegister(instr->left());
2428 int true_block = chunk_->LookupDestination(instr->true_block_id()); 2428 int true_block = chunk_->LookupDestination(instr->true_block_id());
2429 int false_block = chunk_->LookupDestination(instr->false_block_id()); 2429 int false_block = chunk_->LookupDestination(instr->false_block_id());
2430 2430
2431 __ cmp(left, Operand(instr->hydrogen()->right())); 2431 __ cmp(left, Operand(instr->hydrogen()->right()));
2432 EmitBranch(true_block, false_block, eq); 2432 EmitBranch(true_block, false_block, eq);
2433 } 2433 }
2434 2434
2435 2435
2436 void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) {
2437 Register scratch = scratch0();
2438 Register reg = ToRegister(instr->value());
2439 int false_block = chunk_->LookupDestination(instr->false_block_id());
2440
2441 // If the expression is known to be untagged or a smi, then it's definitely
2442 // not null, and it can't be a an undetectable object.
2443 if (instr->hydrogen()->representation().IsSpecialization() ||
2444 instr->hydrogen()->type().IsSmi()) {
2445 EmitGoto(false_block);
2446 return;
2447 }
2448
2449 int true_block = chunk_->LookupDestination(instr->true_block_id());
2450 Heap::RootListIndex nil_value = instr->nil() == kNullValue ?
2451 Heap::kNullValueRootIndex :
2452 Heap::kUndefinedValueRootIndex;
2453 __ LoadRoot(ip, nil_value);
2454 __ cmp(reg, ip);
2455 if (instr->kind() == kStrictEquality) {
2456 EmitBranch(true_block, false_block, eq);
2457 } else {
2458 Heap::RootListIndex other_nil_value = instr->nil() == kNullValue ?
2459 Heap::kUndefinedValueRootIndex :
2460 Heap::kNullValueRootIndex;
2461 Label* true_label = chunk_->GetAssemblyLabel(true_block);
2462 Label* false_label = chunk_->GetAssemblyLabel(false_block);
2463 __ b(eq, true_label);
2464 __ LoadRoot(ip, other_nil_value);
2465 __ cmp(reg, ip);
2466 __ b(eq, true_label);
2467 __ JumpIfSmi(reg, false_label);
2468 // Check for undetectable objects by looking in the bit field in
2469 // the map. The object has already been smi checked.
2470 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
2471 __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset));
2472 __ tst(scratch, Operand(1 << Map::kIsUndetectable));
2473 EmitBranch(true_block, false_block, ne);
2474 }
2475 }
2476
2477
2478 Condition LCodeGen::EmitIsObject(Register input, 2436 Condition LCodeGen::EmitIsObject(Register input,
2479 Register temp1, 2437 Register temp1,
2480 Label* is_not_object, 2438 Label* is_not_object,
2481 Label* is_object) { 2439 Label* is_object) {
2482 Register temp2 = scratch0(); 2440 Register temp2 = scratch0();
2483 __ JumpIfSmi(input, is_not_object); 2441 __ JumpIfSmi(input, is_not_object);
2484 2442
2485 __ LoadRoot(temp2, Heap::kNullValueRootIndex); 2443 __ LoadRoot(temp2, Heap::kNullValueRootIndex);
2486 __ cmp(input, temp2); 2444 __ cmp(input, temp2);
2487 __ b(eq, is_object); 2445 __ b(eq, is_object);
(...skipping 3520 matching lines...) Expand 10 before | Expand all | Expand 10 after
6008 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 5966 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
6009 __ ldr(result, FieldMemOperand(scratch, 5967 __ ldr(result, FieldMemOperand(scratch,
6010 FixedArray::kHeaderSize - kPointerSize)); 5968 FixedArray::kHeaderSize - kPointerSize));
6011 __ bind(&done); 5969 __ bind(&done);
6012 } 5970 }
6013 5971
6014 5972
6015 #undef __ 5973 #undef __
6016 5974
6017 } } // namespace v8::internal 5975 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698