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

Side by Side Diff: src/crankshaft/x87/lithium-codegen-x87.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/x64/lithium-x64.cc ('k') | src/crankshaft/x87/lithium-x87.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_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/crankshaft/x87/lithium-codegen-x87.h" 7 #include "src/crankshaft/x87/lithium-codegen-x87.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 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 } 1945 }
1946 1946
1947 1947
1948 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { 1948 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
1949 Register result = ToRegister(instr->result()); 1949 Register result = ToRegister(instr->result());
1950 Register map = ToRegister(instr->value()); 1950 Register map = ToRegister(instr->value());
1951 __ EnumLength(result, map); 1951 __ EnumLength(result, map);
1952 } 1952 }
1953 1953
1954 1954
1955 void LCodeGen::DoDateField(LDateField* instr) {
1956 Register object = ToRegister(instr->date());
1957 Register result = ToRegister(instr->result());
1958 Register scratch = ToRegister(instr->temp());
1959 Smi* index = instr->index();
1960 DCHECK(object.is(result));
1961 DCHECK(object.is(eax));
1962
1963 if (index->value() == 0) {
1964 __ mov(result, FieldOperand(object, JSDate::kValueOffset));
1965 } else {
1966 Label runtime, done;
1967 if (index->value() < JSDate::kFirstUncachedField) {
1968 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
1969 __ mov(scratch, Operand::StaticVariable(stamp));
1970 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset));
1971 __ j(not_equal, &runtime, Label::kNear);
1972 __ mov(result, FieldOperand(object, JSDate::kValueOffset +
1973 kPointerSize * index->value()));
1974 __ jmp(&done, Label::kNear);
1975 }
1976 __ bind(&runtime);
1977 __ PrepareCallCFunction(2, scratch);
1978 __ mov(Operand(esp, 0), object);
1979 __ mov(Operand(esp, 1 * kPointerSize), Immediate(index));
1980 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
1981 __ bind(&done);
1982 }
1983 }
1984
1985
1986 Operand LCodeGen::BuildSeqStringOperand(Register string, 1955 Operand LCodeGen::BuildSeqStringOperand(Register string,
1987 LOperand* index, 1956 LOperand* index,
1988 String::Encoding encoding) { 1957 String::Encoding encoding) {
1989 if (index->IsConstantOperand()) { 1958 if (index->IsConstantOperand()) {
1990 int offset = ToRepresentation(LConstantOperand::cast(index), 1959 int offset = ToRepresentation(LConstantOperand::cast(index),
1991 Representation::Integer32()); 1960 Representation::Integer32());
1992 if (encoding == String::TWO_BYTE_ENCODING) { 1961 if (encoding == String::TWO_BYTE_ENCODING) {
1993 offset *= kUC16Size; 1962 offset *= kUC16Size;
1994 } 1963 }
1995 STATIC_ASSERT(kCharSize == 1); 1964 STATIC_ASSERT(kCharSize == 1);
(...skipping 4064 matching lines...) Expand 10 before | Expand all | Expand 10 after
6060 RecordSafepoint(Safepoint::kNoLazyDeopt); 6029 RecordSafepoint(Safepoint::kNoLazyDeopt);
6061 } 6030 }
6062 6031
6063 6032
6064 #undef __ 6033 #undef __
6065 6034
6066 } // namespace internal 6035 } // namespace internal
6067 } // namespace v8 6036 } // namespace v8
6068 6037
6069 #endif // V8_TARGET_ARCH_X87 6038 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/crankshaft/x64/lithium-x64.cc ('k') | src/crankshaft/x87/lithium-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698