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

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

Issue 12567004: ARM: Optimsisation of ECMA ToInt32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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 5228 matching lines...) Expand 10 before | Expand all | Expand 10 after
5239 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 5239 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
5240 __ cmp(input_reg, Operand(ip)); 5240 __ cmp(input_reg, Operand(ip));
5241 DeoptimizeIf(ne, instr->environment()); 5241 DeoptimizeIf(ne, instr->environment());
5242 __ mov(input_reg, Operand::Zero()); 5242 __ mov(input_reg, Operand::Zero());
5243 __ b(&done); 5243 __ b(&done);
5244 5244
5245 __ bind(&heap_number); 5245 __ bind(&heap_number);
5246 __ sub(scratch1, input_reg, Operand(kHeapObjectTag)); 5246 __ sub(scratch1, input_reg, Operand(kHeapObjectTag));
5247 __ vldr(double_scratch2, scratch1, HeapNumber::kValueOffset); 5247 __ vldr(double_scratch2, scratch1, HeapNumber::kValueOffset);
5248 5248
5249 __ EmitECMATruncate(input_reg, 5249 __ ECMAToInt32VFP(input_reg, double_scratch2, double_scratch,
5250 double_scratch2, 5250 scratch1, scratch2, scratch3);
5251 double_scratch,
5252 scratch1,
5253 scratch2,
5254 scratch3);
5255 5251
5256 } else { 5252 } else {
5257 CpuFeatureScope scope(masm(), VFP3); 5253 CpuFeatureScope scope(masm(), VFP3);
5258 // Deoptimize if we don't have a heap number. 5254 // Deoptimize if we don't have a heap number.
5259 DeoptimizeIf(ne, instr->environment()); 5255 DeoptimizeIf(ne, instr->environment());
5260 5256
5261 __ sub(ip, input_reg, Operand(kHeapObjectTag)); 5257 __ sub(ip, input_reg, Operand(kHeapObjectTag));
5262 __ vldr(double_scratch, ip, HeapNumber::kValueOffset); 5258 __ vldr(double_scratch, ip, HeapNumber::kValueOffset);
5263 __ TryDoubleToInt32Exact(input_reg, double_scratch, double_scratch2); 5259 __ TryDoubleToInt32Exact(input_reg, double_scratch, double_scratch2);
5264 DeoptimizeIf(ne, instr->environment()); 5260 DeoptimizeIf(ne, instr->environment());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
5342 Register result_reg = ToRegister(instr->result()); 5338 Register result_reg = ToRegister(instr->result());
5343 Register scratch1 = scratch0(); 5339 Register scratch1 = scratch0();
5344 Register scratch2 = ToRegister(instr->temp()); 5340 Register scratch2 = ToRegister(instr->temp());
5345 DwVfpRegister double_input = ToDoubleRegister(instr->value()); 5341 DwVfpRegister double_input = ToDoubleRegister(instr->value());
5346 DwVfpRegister double_scratch = double_scratch0(); 5342 DwVfpRegister double_scratch = double_scratch0();
5347 5343
5348 Label done; 5344 Label done;
5349 5345
5350 if (instr->truncating()) { 5346 if (instr->truncating()) {
5351 Register scratch3 = ToRegister(instr->temp2()); 5347 Register scratch3 = ToRegister(instr->temp2());
5352 __ EmitECMATruncate(result_reg, 5348 __ ECMAToInt32VFP(result_reg, double_input, double_scratch,
5353 double_input, 5349 scratch1, scratch2, scratch3);
5354 double_scratch,
5355 scratch1,
5356 scratch2,
5357 scratch3);
5358 } else { 5350 } else {
5359 __ TryDoubleToInt32Exact(result_reg, double_input, double_scratch); 5351 __ TryDoubleToInt32Exact(result_reg, double_input, double_scratch);
5360 // Deoptimize if the input wasn't a int32 (inside a double). 5352 // Deoptimize if the input wasn't a int32 (inside a double).
5361 DeoptimizeIf(ne, instr->environment()); 5353 DeoptimizeIf(ne, instr->environment());
5362 } 5354 }
5363 __ bind(&done); 5355 __ bind(&done);
5364 } 5356 }
5365 5357
5366 5358
5367 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { 5359 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
6391 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 6383 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
6392 __ ldr(result, FieldMemOperand(scratch, 6384 __ ldr(result, FieldMemOperand(scratch,
6393 FixedArray::kHeaderSize - kPointerSize)); 6385 FixedArray::kHeaderSize - kPointerSize));
6394 __ bind(&done); 6386 __ bind(&done);
6395 } 6387 }
6396 6388
6397 6389
6398 #undef __ 6390 #undef __
6399 6391
6400 } } // namespace v8::internal 6392 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698