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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 15302004: Convert ToBooleanStub to a HydrogenStub. Currently just using HBranch, which is still fully impleme… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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
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 2216 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 2227
2228 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { 2228 void LCodeGen::DoDebugBreak(LDebugBreak* instr) {
2229 __ stop("LBreak"); 2229 __ stop("LBreak");
2230 } 2230 }
2231 2231
2232 2232
2233 void LCodeGen::DoBranch(LBranch* instr) { 2233 void LCodeGen::DoBranch(LBranch* instr) {
2234 int true_block = chunk_->LookupDestination(instr->true_block_id()); 2234 int true_block = chunk_->LookupDestination(instr->true_block_id());
2235 int false_block = chunk_->LookupDestination(instr->false_block_id()); 2235 int false_block = chunk_->LookupDestination(instr->false_block_id());
2236 2236
2237 FOR_ASSERT(bool considered_typefeedback = false);
2237 Representation r = instr->hydrogen()->value()->representation(); 2238 Representation r = instr->hydrogen()->value()->representation();
2238 if (r.IsInteger32() || r.IsSmi()) { 2239 if (r.IsInteger32() || r.IsSmi()) {
2239 Register reg = ToRegister(instr->value()); 2240 Register reg = ToRegister(instr->value());
2240 __ cmp(reg, Operand::Zero()); 2241 __ cmp(reg, Operand::Zero());
2241 EmitBranch(true_block, false_block, ne); 2242 EmitBranch(true_block, false_block, ne);
2242 } else if (r.IsDouble()) { 2243 } else if (r.IsDouble()) {
2243 DwVfpRegister reg = ToDoubleRegister(instr->value()); 2244 DwVfpRegister reg = ToDoubleRegister(instr->value());
2244 // Test the double value. Zero and NaN are false. 2245 // Test the double value. Zero and NaN are false.
2245 __ VFPCompareAndSetFlags(reg, 0.0); 2246 __ VFPCompareAndSetFlags(reg, 0.0);
2246 __ cmp(r0, r0, vs); // If NaN, set the Z flag. 2247 __ cmp(r0, r0, vs); // If NaN, set the Z flag.
2247 EmitBranch(true_block, false_block, ne); 2248 EmitBranch(true_block, false_block, ne);
2248 } else { 2249 } else {
2249 ASSERT(r.IsTagged()); 2250 ASSERT(r.IsTagged());
2250 Register reg = ToRegister(instr->value()); 2251 Register reg = ToRegister(instr->value());
2251 HType type = instr->hydrogen()->value()->type(); 2252 HType type = instr->hydrogen()->value()->type();
2252 if (type.IsBoolean()) { 2253 if (type.IsBoolean()) {
2253 __ CompareRoot(reg, Heap::kTrueValueRootIndex); 2254 __ CompareRoot(reg, Heap::kTrueValueRootIndex);
2254 EmitBranch(true_block, false_block, eq); 2255 EmitBranch(true_block, false_block, eq);
2255 } else if (type.IsSmi()) { 2256 } else if (type.IsSmi()) {
2256 __ cmp(reg, Operand::Zero()); 2257 __ cmp(reg, Operand::Zero());
2257 EmitBranch(true_block, false_block, ne); 2258 EmitBranch(true_block, false_block, ne);
2258 } else { 2259 } else {
2259 Label* true_label = chunk_->GetAssemblyLabel(true_block); 2260 Label* true_label = chunk_->GetAssemblyLabel(true_block);
2260 Label* false_label = chunk_->GetAssemblyLabel(false_block); 2261 Label* false_label = chunk_->GetAssemblyLabel(false_block);
2261 2262
2263 FOR_ASSERT(considered_typefeedback = true);
2262 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); 2264 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types();
2263 // Avoid deopts in the case where we've never executed this path before. 2265 // Avoid deopts in the case where we've never executed this path before.
2264 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); 2266 if (expected.IsEmpty()) expected = ToBooleanStub::all_types();
2265 2267
2266 if (expected.Contains(ToBooleanStub::UNDEFINED)) { 2268 if (expected.Contains(ToBooleanStub::UNDEFINED)) {
2267 // undefined -> false. 2269 // undefined -> false.
2268 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); 2270 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex);
2269 __ b(eq, false_label); 2271 __ b(eq, false_label);
2270 } 2272 }
2271 if (expected.Contains(ToBooleanStub::BOOLEAN)) { 2273 if (expected.Contains(ToBooleanStub::BOOLEAN)) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 __ cmp(r0, r0, vs); // NaN -> false. 2341 __ cmp(r0, r0, vs); // NaN -> false.
2340 __ b(eq, false_label); // +0, -0 -> false. 2342 __ b(eq, false_label); // +0, -0 -> false.
2341 __ b(true_label); 2343 __ b(true_label);
2342 __ bind(&not_heap_number); 2344 __ bind(&not_heap_number);
2343 } 2345 }
2344 2346
2345 // We've seen something for the first time -> deopt. 2347 // We've seen something for the first time -> deopt.
2346 DeoptimizeIf(al, instr->environment()); 2348 DeoptimizeIf(al, instr->environment());
2347 } 2349 }
2348 } 2350 }
2351 // Make sure not to poison the stub cache.
2352 ASSERT(info()->IsStub() ? considered_typefeedback : true);
2349 } 2353 }
2350 2354
2351 2355
2352 void LCodeGen::EmitGoto(int block) { 2356 void LCodeGen::EmitGoto(int block) {
2353 if (!IsNextEmittedBlock(block)) { 2357 if (!IsNextEmittedBlock(block)) {
2354 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); 2358 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block)));
2355 } 2359 }
2356 } 2360 }
2357 2361
2358 2362
(...skipping 3620 matching lines...) Expand 10 before | Expand all | Expand 10 after
5979 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5983 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5980 __ ldr(result, FieldMemOperand(scratch, 5984 __ ldr(result, FieldMemOperand(scratch,
5981 FixedArray::kHeaderSize - kPointerSize)); 5985 FixedArray::kHeaderSize - kPointerSize));
5982 __ bind(&done); 5986 __ bind(&done);
5983 } 5987 }
5984 5988
5985 5989
5986 #undef __ 5990 #undef __
5987 5991
5988 } } // namespace v8::internal 5992 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/checks.h » ('j') | src/checks.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698