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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.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 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) { 2301 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) {
2302 Register left = ToRegister(instr->left()); 2302 Register left = ToRegister(instr->left());
2303 int true_block = chunk_->LookupDestination(instr->true_block_id()); 2303 int true_block = chunk_->LookupDestination(instr->true_block_id());
2304 int false_block = chunk_->LookupDestination(instr->false_block_id()); 2304 int false_block = chunk_->LookupDestination(instr->false_block_id());
2305 2305
2306 __ cmp(left, instr->hydrogen()->right()); 2306 __ cmp(left, instr->hydrogen()->right());
2307 EmitBranch(true_block, false_block, equal); 2307 EmitBranch(true_block, false_block, equal);
2308 } 2308 }
2309 2309
2310 2310
2311 void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) {
2312 Register reg = ToRegister(instr->value());
2313 int false_block = chunk_->LookupDestination(instr->false_block_id());
2314
2315 // If the expression is known to be untagged or a smi, then it's definitely
2316 // not null, and it can't be a an undetectable object.
2317 if (instr->hydrogen()->representation().IsSpecialization() ||
2318 instr->hydrogen()->type().IsSmi()) {
2319 EmitGoto(false_block);
2320 return;
2321 }
2322
2323 int true_block = chunk_->LookupDestination(instr->true_block_id());
2324 Handle<Object> nil_value = instr->nil() == kNullValue ?
2325 factory()->null_value() :
2326 factory()->undefined_value();
2327 __ cmp(reg, nil_value);
2328 if (instr->kind() == kStrictEquality) {
2329 EmitBranch(true_block, false_block, equal);
2330 } else {
2331 Handle<Object> other_nil_value = instr->nil() == kNullValue ?
2332 factory()->undefined_value() :
2333 factory()->null_value();
2334 Label* true_label = chunk_->GetAssemblyLabel(true_block);
2335 Label* false_label = chunk_->GetAssemblyLabel(false_block);
2336 __ j(equal, true_label);
2337 __ cmp(reg, other_nil_value);
2338 __ j(equal, true_label);
2339 __ JumpIfSmi(reg, false_label);
2340 // Check for undetectable objects by looking in the bit field in
2341 // the map. The object has already been smi checked.
2342 Register scratch = ToRegister(instr->temp());
2343 __ mov(scratch, FieldOperand(reg, HeapObject::kMapOffset));
2344 __ movzx_b(scratch, FieldOperand(scratch, Map::kBitFieldOffset));
2345 __ test(scratch, Immediate(1 << Map::kIsUndetectable));
2346 EmitBranch(true_block, false_block, not_zero);
2347 }
2348 }
2349
2350
2351 Condition LCodeGen::EmitIsObject(Register input, 2311 Condition LCodeGen::EmitIsObject(Register input,
2352 Register temp1, 2312 Register temp1,
2353 Label* is_not_object, 2313 Label* is_not_object,
2354 Label* is_object) { 2314 Label* is_object) {
2355 __ JumpIfSmi(input, is_not_object); 2315 __ JumpIfSmi(input, is_not_object);
2356 2316
2357 __ cmp(input, isolate()->factory()->null_value()); 2317 __ cmp(input, isolate()->factory()->null_value());
2358 __ j(equal, is_object); 2318 __ j(equal, is_object);
2359 2319
2360 __ mov(temp1, FieldOperand(input, HeapObject::kMapOffset)); 2320 __ mov(temp1, FieldOperand(input, HeapObject::kMapOffset));
(...skipping 4190 matching lines...) Expand 10 before | Expand all | Expand 10 after
6551 FixedArray::kHeaderSize - kPointerSize)); 6511 FixedArray::kHeaderSize - kPointerSize));
6552 __ bind(&done); 6512 __ bind(&done);
6553 } 6513 }
6554 6514
6555 6515
6556 #undef __ 6516 #undef __
6557 6517
6558 } } // namespace v8::internal 6518 } } // namespace v8::internal
6559 6519
6560 #endif // V8_TARGET_ARCH_IA32 6520 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698