OLD | NEW |
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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 455 |
456 int32_t LCodeGen::ToInteger32(LConstantOperand* op) const { | 456 int32_t LCodeGen::ToInteger32(LConstantOperand* op) const { |
457 return ToRepresentation(op, Representation::Integer32()); | 457 return ToRepresentation(op, Representation::Integer32()); |
458 } | 458 } |
459 | 459 |
460 | 460 |
461 int32_t LCodeGen::ToRepresentation(LConstantOperand* op, | 461 int32_t LCodeGen::ToRepresentation(LConstantOperand* op, |
462 const Representation& r) const { | 462 const Representation& r) const { |
463 HConstant* constant = chunk_->LookupConstant(op); | 463 HConstant* constant = chunk_->LookupConstant(op); |
464 int32_t value = constant->Integer32Value(); | 464 int32_t value = constant->Integer32Value(); |
465 if (r.IsInteger32()) return value; | 465 if (r.IsInteger32() || r.IsExternal()) return value; |
466 ASSERT(r.IsSmiOrTagged()); | 466 ASSERT(r.IsSmiOrTagged()); |
467 return reinterpret_cast<int32_t>(Smi::FromInt(value)); | 467 return reinterpret_cast<int32_t>(Smi::FromInt(value)); |
468 } | 468 } |
469 | 469 |
470 | 470 |
471 Smi* LCodeGen::ToSmi(LConstantOperand* op) const { | 471 Smi* LCodeGen::ToSmi(LConstantOperand* op) const { |
472 HConstant* constant = chunk_->LookupConstant(op); | 472 HConstant* constant = chunk_->LookupConstant(op); |
473 return Smi::FromInt(constant->Integer32Value()); | 473 return Smi::FromInt(constant->Integer32Value()); |
474 } | 474 } |
475 | 475 |
(...skipping 5461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5937 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5937 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5938 __ ldr(result, FieldMemOperand(scratch, | 5938 __ ldr(result, FieldMemOperand(scratch, |
5939 FixedArray::kHeaderSize - kPointerSize)); | 5939 FixedArray::kHeaderSize - kPointerSize)); |
5940 __ bind(&done); | 5940 __ bind(&done); |
5941 } | 5941 } |
5942 | 5942 |
5943 | 5943 |
5944 #undef __ | 5944 #undef __ |
5945 | 5945 |
5946 } } // namespace v8::internal | 5946 } } // namespace v8::internal |
OLD | NEW |