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

Side by Side Diff: src/mips/builtins-mips.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/js/date.js ('k') | src/mips64/builtins-mips64.cc » ('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_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.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 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 } 1379 }
1380 __ Jump(masm->isolate()->builtins()->OnStackReplacement(), 1380 __ Jump(masm->isolate()->builtins()->OnStackReplacement(),
1381 RelocInfo::CODE_TARGET); 1381 RelocInfo::CODE_TARGET);
1382 1382
1383 __ bind(&ok); 1383 __ bind(&ok);
1384 __ Ret(); 1384 __ Ret();
1385 } 1385 }
1386 1386
1387 1387
1388 // static 1388 // static
1389 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm,
1390 int field_index) {
1391 // ----------- S t a t e -------------
1392 // -- sp[0] : receiver
1393 // -----------------------------------
1394
1395 // 1. Pop receiver into a0 and check that it's actually a JSDate object.
1396 Label receiver_not_date;
1397 {
1398 __ Pop(a0);
1399 __ JumpIfSmi(a0, &receiver_not_date);
1400 __ GetObjectType(a0, t0, t0);
1401 __ Branch(&receiver_not_date, ne, t0, Operand(JS_DATE_TYPE));
1402 }
1403
1404 // 2. Load the specified date field, falling back to the runtime as necessary.
1405 if (field_index == JSDate::kDateValue) {
1406 __ Ret(USE_DELAY_SLOT);
1407 __ lw(v0, FieldMemOperand(a0, JSDate::kValueOffset)); // In delay slot.
1408 } else {
1409 if (field_index < JSDate::kFirstUncachedField) {
1410 Label stamp_mismatch;
1411 __ li(a1, Operand(ExternalReference::date_cache_stamp(masm->isolate())));
1412 __ lw(a1, MemOperand(a1));
1413 __ lw(t0, FieldMemOperand(a0, JSDate::kCacheStampOffset));
1414 __ Branch(&stamp_mismatch, ne, t0, Operand(a1));
1415 __ Ret(USE_DELAY_SLOT);
1416 __ lw(v0, FieldMemOperand(
1417 a0, JSDate::kValueOffset +
1418 field_index * kPointerSize)); // In delay slot.
1419 __ bind(&stamp_mismatch);
1420 }
1421 FrameScope scope(masm, StackFrame::INTERNAL);
1422 __ PrepareCallCFunction(2, t0);
1423 __ li(a1, Operand(Smi::FromInt(field_index)));
1424 __ CallCFunction(
1425 ExternalReference::get_date_field_function(masm->isolate()), 2);
1426 __ Ret();
1427 }
1428
1429 // 3. Raise a TypeError if the receiver is not a date.
1430 __ bind(&receiver_not_date);
1431 __ TailCallRuntime(Runtime::kThrowNotDateError);
1432 }
1433
1434
1435 // static
1389 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { 1436 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
1390 // ----------- S t a t e ------------- 1437 // ----------- S t a t e -------------
1391 // -- a0 : argc 1438 // -- a0 : argc
1392 // -- sp[0] : argArray 1439 // -- sp[0] : argArray
1393 // -- sp[4] : thisArg 1440 // -- sp[4] : thisArg
1394 // -- sp[8] : receiver 1441 // -- sp[8] : receiver
1395 // ----------------------------------- 1442 // -----------------------------------
1396 1443
1397 // 1. Load receiver into a1, argArray into a0 (if present), remove all 1444 // 1. Load receiver into a1, argArray into a0 (if present), remove all
1398 // arguments from the stack (including the receiver), and push thisArg (if 1445 // arguments from the stack (including the receiver), and push thisArg (if
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2419 } 2466 }
2420 } 2467 }
2421 2468
2422 2469
2423 #undef __ 2470 #undef __
2424 2471
2425 } // namespace internal 2472 } // namespace internal
2426 } // namespace v8 2473 } // namespace v8
2427 2474
2428 #endif // V8_TARGET_ARCH_MIPS 2475 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/js/date.js ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698