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

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

Issue 1576813003: X87: [date] Migrate Date field accessors to native builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | no next file » | 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/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 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after
2379 2431
2380 __ bind(&ok); 2432 __ bind(&ok);
2381 __ ret(0); 2433 __ ret(0);
2382 } 2434 }
2383 2435
2384 #undef __ 2436 #undef __
2385 } // namespace internal 2437 } // namespace internal
2386 } // namespace v8 2438 } // namespace v8
2387 2439
2388 #endif // V8_TARGET_ARCH_X87 2440 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698