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

Side by Side Diff: src/ia32/builtins-ia32.cc

Issue 1567353002: [date] Migrate Date field accessors to native builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moar work. ports. 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/full-codegen/x64/full-codegen-x64.cc ('k') | src/js/date.js » ('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/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); 994 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT);
995 } 995 }
996 996
997 997
998 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { 998 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) {
999 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); 999 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
1000 } 1000 }
1001 1001
1002 1002
1003 // static 1003 // static
1004 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm,
1005 int field_index) {
1006 // ----------- S t a t e -------------
1007 // -- esp[0] : return address
1008 // -- esp[4] : receiver
1009 // -----------------------------------
1010
1011 // 1. Load receiver into eax and check that it's actually a JSDate object.
1012 Label receiver_not_date;
1013 {
1014 __ mov(eax, Operand(esp, kPointerSize));
1015 __ JumpIfSmi(eax, &receiver_not_date);
1016 __ CmpObjectType(eax, JS_DATE_TYPE, ebx);
1017 __ j(not_equal, &receiver_not_date);
1018 }
1019
1020 // 2. Load the specified date field, falling back to the runtime as necessary.
1021 if (field_index == JSDate::kDateValue) {
1022 __ mov(eax, FieldOperand(eax, JSDate::kValueOffset));
1023 } else {
1024 if (field_index < JSDate::kFirstUncachedField) {
1025 Label stamp_mismatch;
1026 __ mov(edx, Operand::StaticVariable(
1027 ExternalReference::date_cache_stamp(masm->isolate())));
1028 __ cmp(edx, FieldOperand(eax, JSDate::kCacheStampOffset));
1029 __ j(not_equal, &stamp_mismatch, Label::kNear);
1030 __ mov(eax, FieldOperand(
1031 eax, JSDate::kValueOffset + field_index * kPointerSize));
1032 __ ret(1 * kPointerSize);
1033 __ bind(&stamp_mismatch);
1034 }
1035 FrameScope scope(masm, StackFrame::INTERNAL);
1036 __ PrepareCallCFunction(2, ebx);
1037 __ mov(Operand(esp, 0), eax);
1038 __ mov(Operand(esp, 1 * kPointerSize),
1039 Immediate(Smi::FromInt(field_index)));
1040 __ CallCFunction(
1041 ExternalReference::get_date_field_function(masm->isolate()), 2);
1042 }
1043 __ ret(1 * kPointerSize);
1044
1045 // 3. Raise a TypeError if the receiver is not a date.
1046 __ bind(&receiver_not_date);
1047 {
1048 FrameScope scope(masm, StackFrame::MANUAL);
1049 __ EnterFrame(StackFrame::INTERNAL);
1050 __ CallRuntime(Runtime::kThrowNotDateError);
1051 }
1052 }
1053
1054
1055 // static
1004 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { 1056 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
1005 // ----------- S t a t e ------------- 1057 // ----------- S t a t e -------------
1006 // -- eax : argc 1058 // -- eax : argc
1007 // -- esp[0] : return address 1059 // -- esp[0] : return address
1008 // -- esp[4] : argArray 1060 // -- esp[4] : argArray
1009 // -- esp[8] : thisArg 1061 // -- esp[8] : thisArg
1010 // -- esp[12] : receiver 1062 // -- esp[12] : receiver
1011 // ----------------------------------- 1063 // -----------------------------------
1012 1064
1013 // 1. Load receiver into edi, argArray into eax (if present), remove all 1065 // 1. Load receiver into edi, argArray into eax (if present), remove all
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after
2372 2424
2373 __ bind(&ok); 2425 __ bind(&ok);
2374 __ ret(0); 2426 __ ret(0);
2375 } 2427 }
2376 2428
2377 #undef __ 2429 #undef __
2378 } // namespace internal 2430 } // namespace internal
2379 } // namespace v8 2431 } // namespace v8
2380 2432
2381 #endif // V8_TARGET_ARCH_IA32 2433 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/js/date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698