OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 5290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5301 if (instr->truncating()) { | 5301 if (instr->truncating()) { |
5302 Register output = ToRegister(instr->result()); | 5302 Register output = ToRegister(instr->result()); |
5303 Register scratch2 = ToRegister(temp2); | 5303 Register scratch2 = ToRegister(temp2); |
5304 Label check_bools; | 5304 Label check_bools; |
5305 | 5305 |
5306 // If it's not a heap number, jump to undefined check. | 5306 // If it's not a heap number, jump to undefined check. |
5307 __ JumpIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, &check_bools); | 5307 __ JumpIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, &check_bools); |
5308 | 5308 |
5309 // A heap number: load value and convert to int32 using truncating function. | 5309 // A heap number: load value and convert to int32 using truncating function. |
5310 __ Ldr(dbl_scratch1, FieldMemOperand(input, HeapNumber::kValueOffset)); | 5310 __ Ldr(dbl_scratch1, FieldMemOperand(input, HeapNumber::kValueOffset)); |
5311 __ ECMA262ToInt32(output, dbl_scratch1, scratch1, scratch2); | 5311 __ TruncateDoubleToI(output, dbl_scratch1); |
5312 __ B(&done); | 5312 __ B(&done); |
5313 | 5313 |
5314 __ Bind(&check_bools); | 5314 __ Bind(&check_bools); |
5315 | 5315 |
5316 Register true_root = output; | 5316 Register true_root = output; |
5317 Register false_root = scratch2; | 5317 Register false_root = scratch2; |
5318 __ LoadTrueFalseRoots(true_root, false_root); | 5318 __ LoadTrueFalseRoots(true_root, false_root); |
5319 __ Cmp(scratch1, true_root); | 5319 __ Cmp(scratch1, true_root); |
5320 __ Cset(output, eq); | 5320 __ Cset(output, eq); |
5321 __ Ccmp(scratch1, false_root, ZFlag, ne); | 5321 __ Ccmp(scratch1, false_root, ZFlag, ne); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5488 Label no_memento_found; | 5488 Label no_memento_found; |
5489 __ JumpIfJSArrayHasAllocationMemento(object, temp1, temp2, &no_memento_found); | 5489 __ JumpIfJSArrayHasAllocationMemento(object, temp1, temp2, &no_memento_found); |
5490 Deoptimize(instr->environment()); | 5490 Deoptimize(instr->environment()); |
5491 __ Bind(&no_memento_found); | 5491 __ Bind(&no_memento_found); |
5492 } | 5492 } |
5493 | 5493 |
5494 | 5494 |
5495 void LCodeGen::DoTruncateDoubleToIntOrSmi(LTruncateDoubleToIntOrSmi* instr) { | 5495 void LCodeGen::DoTruncateDoubleToIntOrSmi(LTruncateDoubleToIntOrSmi* instr) { |
5496 DoubleRegister input = ToDoubleRegister(instr->value()); | 5496 DoubleRegister input = ToDoubleRegister(instr->value()); |
5497 Register result = ToRegister(instr->result()); | 5497 Register result = ToRegister(instr->result()); |
5498 __ ECMA262ToInt32(result, input, | 5498 __ TruncateDoubleToI(result, input); |
5499 ToRegister(instr->temp1()), | 5499 if (instr->tag_result()) { |
5500 ToRegister(instr->temp2()), | 5500 __ SmiTag(result, result); |
5501 instr->tag_result() | 5501 } |
5502 ? MacroAssembler::SMI | |
5503 : MacroAssembler::INT32_IN_W); | |
5504 } | 5502 } |
5505 | 5503 |
5506 | 5504 |
5507 void LCodeGen::DoTypeof(LTypeof* instr) { | 5505 void LCodeGen::DoTypeof(LTypeof* instr) { |
5508 Register input = ToRegister(instr->value()); | 5506 Register input = ToRegister(instr->value()); |
5509 __ Push(input); | 5507 __ Push(input); |
5510 CallRuntime(Runtime::kTypeof, 1, instr); | 5508 CallRuntime(Runtime::kTypeof, 1, instr); |
5511 } | 5509 } |
5512 | 5510 |
5513 | 5511 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5701 __ Bind(&out_of_object); | 5699 __ Bind(&out_of_object); |
5702 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5700 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
5703 // Index is equal to negated out of object property index plus 1. | 5701 // Index is equal to negated out of object property index plus 1. |
5704 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5702 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
5705 __ Ldr(result, FieldMemOperand(result, | 5703 __ Ldr(result, FieldMemOperand(result, |
5706 FixedArray::kHeaderSize - kPointerSize)); | 5704 FixedArray::kHeaderSize - kPointerSize)); |
5707 __ Bind(&done); | 5705 __ Bind(&done); |
5708 } | 5706 } |
5709 | 5707 |
5710 } } // namespace v8::internal | 5708 } } // namespace v8::internal |
OLD | NEW |