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

Side by Side Diff: src/crankshaft/ia32/lithium-codegen-ia32.cc

Issue 1579613002: [builtins] Refactor the remaining Date builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: As per offline discussion, remove the weird test, which does not add a lot of value. Created 4 years, 11 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
« no previous file with comments | « src/crankshaft/hydrogen-instructions.cc ('k') | src/crankshaft/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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h"
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 } 1668 }
1669 1669
1670 1670
1671 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { 1671 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
1672 Register result = ToRegister(instr->result()); 1672 Register result = ToRegister(instr->result());
1673 Register map = ToRegister(instr->value()); 1673 Register map = ToRegister(instr->value());
1674 __ EnumLength(result, map); 1674 __ EnumLength(result, map);
1675 } 1675 }
1676 1676
1677 1677
1678 void LCodeGen::DoDateField(LDateField* instr) {
1679 Register object = ToRegister(instr->date());
1680 Register result = ToRegister(instr->result());
1681 Register scratch = ToRegister(instr->temp());
1682 Smi* index = instr->index();
1683 DCHECK(object.is(result));
1684 DCHECK(object.is(eax));
1685
1686 if (index->value() == 0) {
1687 __ mov(result, FieldOperand(object, JSDate::kValueOffset));
1688 } else {
1689 Label runtime, done;
1690 if (index->value() < JSDate::kFirstUncachedField) {
1691 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
1692 __ mov(scratch, Operand::StaticVariable(stamp));
1693 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset));
1694 __ j(not_equal, &runtime, Label::kNear);
1695 __ mov(result, FieldOperand(object, JSDate::kValueOffset +
1696 kPointerSize * index->value()));
1697 __ jmp(&done, Label::kNear);
1698 }
1699 __ bind(&runtime);
1700 __ PrepareCallCFunction(2, scratch);
1701 __ mov(Operand(esp, 0), object);
1702 __ mov(Operand(esp, 1 * kPointerSize), Immediate(index));
1703 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
1704 __ bind(&done);
1705 }
1706 }
1707
1708
1709 Operand LCodeGen::BuildSeqStringOperand(Register string, 1678 Operand LCodeGen::BuildSeqStringOperand(Register string,
1710 LOperand* index, 1679 LOperand* index,
1711 String::Encoding encoding) { 1680 String::Encoding encoding) {
1712 if (index->IsConstantOperand()) { 1681 if (index->IsConstantOperand()) {
1713 int offset = ToRepresentation(LConstantOperand::cast(index), 1682 int offset = ToRepresentation(LConstantOperand::cast(index),
1714 Representation::Integer32()); 1683 Representation::Integer32());
1715 if (encoding == String::TWO_BYTE_ENCODING) { 1684 if (encoding == String::TWO_BYTE_ENCODING) {
1716 offset *= kUC16Size; 1685 offset *= kUC16Size;
1717 } 1686 }
1718 STATIC_ASSERT(kCharSize == 1); 1687 STATIC_ASSERT(kCharSize == 1);
(...skipping 3780 matching lines...) Expand 10 before | Expand all | Expand 10 after
5499 RecordSafepoint(Safepoint::kNoLazyDeopt); 5468 RecordSafepoint(Safepoint::kNoLazyDeopt);
5500 } 5469 }
5501 5470
5502 5471
5503 #undef __ 5472 #undef __
5504 5473
5505 } // namespace internal 5474 } // namespace internal
5506 } // namespace v8 5475 } // namespace v8
5507 5476
5508 #endif // V8_TARGET_ARCH_IA32 5477 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen-instructions.cc ('k') | src/crankshaft/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698