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

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 246643014: CodeStubs contain their corresponding Isolate* now. (part 1) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Feedback. Rebased. Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/arm/debug-arm.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 Label* lhs_not_nan, 497 Label* lhs_not_nan,
498 Label* slow, 498 Label* slow,
499 bool strict); 499 bool strict);
500 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, 500 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm,
501 Register lhs, 501 Register lhs,
502 Register rhs); 502 Register rhs);
503 503
504 504
505 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { 505 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) {
506 // Update the static counter each time a new code stub is generated. 506 // Update the static counter each time a new code stub is generated.
507 Isolate* isolate = masm->isolate(); 507 isolate()->counters()->code_stubs()->Increment();
508 isolate->counters()->code_stubs()->Increment();
509 508
510 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(isolate); 509 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(isolate());
511 int param_count = descriptor->register_param_count_; 510 int param_count = descriptor->register_param_count_;
512 { 511 {
513 // Call the runtime system in a fresh internal frame. 512 // Call the runtime system in a fresh internal frame.
514 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 513 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
515 ASSERT(descriptor->register_param_count_ == 0 || 514 ASSERT(descriptor->register_param_count_ == 0 ||
516 r0.is(descriptor->register_params_[param_count - 1])); 515 r0.is(descriptor->register_params_[param_count - 1]));
517 // Push arguments 516 // Push arguments
518 for (int i = 0; i < param_count; ++i) { 517 for (int i = 0; i < param_count; ++i) {
519 __ push(descriptor->register_params_[i]); 518 __ push(descriptor->register_params_[i]);
520 } 519 }
521 ExternalReference miss = descriptor->miss_handler(); 520 ExternalReference miss = descriptor->miss_handler();
522 __ CallExternalReference(miss, descriptor->register_param_count_); 521 __ CallExternalReference(miss, descriptor->register_param_count_);
523 } 522 }
524 523
525 __ Ret(); 524 __ Ret();
526 } 525 }
527 526
528 527
529 // Takes a Smi and converts to an IEEE 64 bit floating point value in two 528 // Takes a Smi and converts to an IEEE 64 bit floating point value in two
530 // registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and 529 // registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and
531 // 52 fraction bits (20 in the first word, 32 in the second). Zeros is a 530 // 52 fraction bits (20 in the first word, 32 in the second). Zeros is a
532 // scratch register. Destroys the source register. No GC occurs during this 531 // scratch register. Destroys the source register. No GC occurs during this
533 // stub so you don't have to set up the frame. 532 // stub so you don't have to set up the frame.
534 class ConvertToDoubleStub : public PlatformCodeStub { 533 class ConvertToDoubleStub : public PlatformCodeStub {
535 public: 534 public:
536 ConvertToDoubleStub(Register result_reg_1, 535 ConvertToDoubleStub(Isolate* isolate,
536 Register result_reg_1,
537 Register result_reg_2, 537 Register result_reg_2,
538 Register source_reg, 538 Register source_reg,
539 Register scratch_reg) 539 Register scratch_reg)
540 : result1_(result_reg_1), 540 : PlatformCodeStub(isolate),
541 result1_(result_reg_1),
541 result2_(result_reg_2), 542 result2_(result_reg_2),
542 source_(source_reg), 543 source_(source_reg),
543 zeros_(scratch_reg) { } 544 zeros_(scratch_reg) { }
544 545
545 private: 546 private:
546 Register result1_; 547 Register result1_;
547 Register result2_; 548 Register result2_;
548 Register source_; 549 Register source_;
549 Register zeros_; 550 Register zeros_;
550 551
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 720
720 __ bind(&done); 721 __ bind(&done);
721 722
722 __ Pop(scratch_high, scratch_low, scratch); 723 __ Pop(scratch_high, scratch_low, scratch);
723 __ Ret(); 724 __ Ret();
724 } 725 }
725 726
726 727
727 void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime( 728 void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(
728 Isolate* isolate) { 729 Isolate* isolate) {
729 WriteInt32ToHeapNumberStub stub1(r1, r0, r2); 730 WriteInt32ToHeapNumberStub stub1(isolate, r1, r0, r2);
730 WriteInt32ToHeapNumberStub stub2(r2, r0, r3); 731 WriteInt32ToHeapNumberStub stub2(isolate, r2, r0, r3);
731 stub1.GetCode(isolate); 732 stub1.GetCode(isolate);
732 stub2.GetCode(isolate); 733 stub2.GetCode(isolate);
733 } 734 }
734 735
735 736
736 // See comment for class. 737 // See comment for class.
737 void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) { 738 void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) {
738 Label max_negative_int; 739 Label max_negative_int;
739 // the_int_ has the answer which is a signed int32 but not a Smi. 740 // the_int_ has the answer which is a signed int32 but not a Smi.
740 // We test for the special value that has a different exponent. This test 741 // We test for the special value that has a different exponent. This test
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 // 4) Jump to lhs_not_nan. 1118 // 4) Jump to lhs_not_nan.
1118 // In cases 3 and 4 we have found out we were dealing with a number-number 1119 // In cases 3 and 4 we have found out we were dealing with a number-number
1119 // comparison. If VFP3 is supported the double values of the numbers have 1120 // comparison. If VFP3 is supported the double values of the numbers have
1120 // been loaded into d7 and d6. Otherwise, the double values have been loaded 1121 // been loaded into d7 and d6. Otherwise, the double values have been loaded
1121 // into r0, r1, r2, and r3. 1122 // into r0, r1, r2, and r3.
1122 EmitSmiNonsmiComparison(masm, lhs, rhs, &lhs_not_nan, &slow, strict()); 1123 EmitSmiNonsmiComparison(masm, lhs, rhs, &lhs_not_nan, &slow, strict());
1123 1124
1124 __ bind(&both_loaded_as_doubles); 1125 __ bind(&both_loaded_as_doubles);
1125 // The arguments have been converted to doubles and stored in d6 and d7, if 1126 // The arguments have been converted to doubles and stored in d6 and d7, if
1126 // VFP3 is supported, or in r0, r1, r2, and r3. 1127 // VFP3 is supported, or in r0, r1, r2, and r3.
1127 Isolate* isolate = masm->isolate();
1128 __ bind(&lhs_not_nan); 1128 __ bind(&lhs_not_nan);
1129 Label no_nan; 1129 Label no_nan;
1130 // ARMv7 VFP3 instructions to implement double precision comparison. 1130 // ARMv7 VFP3 instructions to implement double precision comparison.
1131 __ VFPCompareAndSetFlags(d7, d6); 1131 __ VFPCompareAndSetFlags(d7, d6);
1132 Label nan; 1132 Label nan;
1133 __ b(vs, &nan); 1133 __ b(vs, &nan);
1134 __ mov(r0, Operand(EQUAL), LeaveCC, eq); 1134 __ mov(r0, Operand(EQUAL), LeaveCC, eq);
1135 __ mov(r0, Operand(LESS), LeaveCC, lt); 1135 __ mov(r0, Operand(LESS), LeaveCC, lt);
1136 __ mov(r0, Operand(GREATER), LeaveCC, gt); 1136 __ mov(r0, Operand(GREATER), LeaveCC, gt);
1137 __ Ret(); 1137 __ Ret();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 EmitCheckForInternalizedStringsOrObjects( 1180 EmitCheckForInternalizedStringsOrObjects(
1181 masm, lhs, rhs, &flat_string_check, &slow); 1181 masm, lhs, rhs, &flat_string_check, &slow);
1182 } 1182 }
1183 1183
1184 // Check for both being sequential ASCII strings, and inline if that is the 1184 // Check for both being sequential ASCII strings, and inline if that is the
1185 // case. 1185 // case.
1186 __ bind(&flat_string_check); 1186 __ bind(&flat_string_check);
1187 1187
1188 __ JumpIfNonSmisNotBothSequentialAsciiStrings(lhs, rhs, r2, r3, &slow); 1188 __ JumpIfNonSmisNotBothSequentialAsciiStrings(lhs, rhs, r2, r3, &slow);
1189 1189
1190 __ IncrementCounter(isolate->counters()->string_compare_native(), 1, r2, r3); 1190 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, r2,
1191 r3);
1191 if (cc == eq) { 1192 if (cc == eq) {
1192 StringCompareStub::GenerateFlatAsciiStringEquals(masm, 1193 StringCompareStub::GenerateFlatAsciiStringEquals(masm,
1193 lhs, 1194 lhs,
1194 rhs, 1195 rhs,
1195 r2, 1196 r2,
1196 r3, 1197 r3,
1197 r4); 1198 r4);
1198 } else { 1199 } else {
1199 StringCompareStub::GenerateCompareFlatAsciiStrings(masm, 1200 StringCompareStub::GenerateCompareFlatAsciiStrings(masm,
1200 lhs, 1201 lhs,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 const Register scratch = r1; 1245 const Register scratch = r1;
1245 1246
1246 if (save_doubles_ == kSaveFPRegs) { 1247 if (save_doubles_ == kSaveFPRegs) {
1247 __ SaveFPRegs(sp, scratch); 1248 __ SaveFPRegs(sp, scratch);
1248 } 1249 }
1249 const int argument_count = 1; 1250 const int argument_count = 1;
1250 const int fp_argument_count = 0; 1251 const int fp_argument_count = 0;
1251 1252
1252 AllowExternalCallThatCantCauseGC scope(masm); 1253 AllowExternalCallThatCantCauseGC scope(masm);
1253 __ PrepareCallCFunction(argument_count, fp_argument_count, scratch); 1254 __ PrepareCallCFunction(argument_count, fp_argument_count, scratch);
1254 __ mov(r0, Operand(ExternalReference::isolate_address(masm->isolate()))); 1255 __ mov(r0, Operand(ExternalReference::isolate_address(isolate())));
1255 __ CallCFunction( 1256 __ CallCFunction(
1256 ExternalReference::store_buffer_overflow_function(masm->isolate()), 1257 ExternalReference::store_buffer_overflow_function(isolate()),
1257 argument_count); 1258 argument_count);
1258 if (save_doubles_ == kSaveFPRegs) { 1259 if (save_doubles_ == kSaveFPRegs) {
1259 __ RestoreFPRegs(sp, scratch); 1260 __ RestoreFPRegs(sp, scratch);
1260 } 1261 }
1261 __ ldm(ia_w, sp, kCallerSaved | pc.bit()); // Also pop pc to get Ret(0). 1262 __ ldm(ia_w, sp, kCallerSaved | pc.bit()); // Also pop pc to get Ret(0).
1262 } 1263 }
1263 1264
1264 1265
1265 void MathPowStub::Generate(MacroAssembler* masm) { 1266 void MathPowStub::Generate(MacroAssembler* masm) {
1266 const Register base = r1; 1267 const Register base = r1;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 __ vdiv(double_result, double_result, double_scratch); 1367 __ vdiv(double_result, double_result, double_scratch);
1367 __ jmp(&done); 1368 __ jmp(&done);
1368 } 1369 }
1369 1370
1370 __ push(lr); 1371 __ push(lr);
1371 { 1372 {
1372 AllowExternalCallThatCantCauseGC scope(masm); 1373 AllowExternalCallThatCantCauseGC scope(masm);
1373 __ PrepareCallCFunction(0, 2, scratch); 1374 __ PrepareCallCFunction(0, 2, scratch);
1374 __ MovToFloatParameters(double_base, double_exponent); 1375 __ MovToFloatParameters(double_base, double_exponent);
1375 __ CallCFunction( 1376 __ CallCFunction(
1376 ExternalReference::power_double_double_function(masm->isolate()), 1377 ExternalReference::power_double_double_function(isolate()),
1377 0, 2); 1378 0, 2);
1378 } 1379 }
1379 __ pop(lr); 1380 __ pop(lr);
1380 __ MovFromFloatResult(double_result); 1381 __ MovFromFloatResult(double_result);
1381 __ jmp(&done); 1382 __ jmp(&done);
1382 1383
1383 __ bind(&int_exponent_convert); 1384 __ bind(&int_exponent_convert);
1384 __ vcvt_u32_f64(single_scratch, double_exponent); 1385 __ vcvt_u32_f64(single_scratch, double_exponent);
1385 __ vmov(scratch, single_scratch); 1386 __ vmov(scratch, single_scratch);
1386 } 1387 }
(...skipping 30 matching lines...) Expand all
1417 // Test whether result is zero. Bail out to check for subnormal result. 1418 // Test whether result is zero. Bail out to check for subnormal result.
1418 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. 1419 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases.
1419 __ VFPCompareAndSetFlags(double_result, 0.0); 1420 __ VFPCompareAndSetFlags(double_result, 0.0);
1420 __ b(ne, &done); 1421 __ b(ne, &done);
1421 // double_exponent may not containe the exponent value if the input was a 1422 // double_exponent may not containe the exponent value if the input was a
1422 // smi. We set it with exponent value before bailing out. 1423 // smi. We set it with exponent value before bailing out.
1423 __ vmov(single_scratch, exponent); 1424 __ vmov(single_scratch, exponent);
1424 __ vcvt_f64_s32(double_exponent, single_scratch); 1425 __ vcvt_f64_s32(double_exponent, single_scratch);
1425 1426
1426 // Returning or bailing out. 1427 // Returning or bailing out.
1427 Counters* counters = masm->isolate()->counters(); 1428 Counters* counters = isolate()->counters();
1428 if (exponent_type_ == ON_STACK) { 1429 if (exponent_type_ == ON_STACK) {
1429 // The arguments are still on the stack. 1430 // The arguments are still on the stack.
1430 __ bind(&call_runtime); 1431 __ bind(&call_runtime);
1431 __ TailCallRuntime(Runtime::kHiddenMathPow, 2, 1); 1432 __ TailCallRuntime(Runtime::kHiddenMathPow, 2, 1);
1432 1433
1433 // The stub is called from non-optimized code, which expects the result 1434 // The stub is called from non-optimized code, which expects the result
1434 // as heap number in exponent. 1435 // as heap number in exponent.
1435 __ bind(&done); 1436 __ bind(&done);
1436 __ AllocateHeapNumber( 1437 __ AllocateHeapNumber(
1437 heapnumber, scratch, scratch2, heapnumbermap, &call_runtime); 1438 heapnumber, scratch, scratch2, heapnumbermap, &call_runtime);
1438 __ vstr(double_result, 1439 __ vstr(double_result,
1439 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); 1440 FieldMemOperand(heapnumber, HeapNumber::kValueOffset));
1440 ASSERT(heapnumber.is(r0)); 1441 ASSERT(heapnumber.is(r0));
1441 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2); 1442 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2);
1442 __ Ret(2); 1443 __ Ret(2);
1443 } else { 1444 } else {
1444 __ push(lr); 1445 __ push(lr);
1445 { 1446 {
1446 AllowExternalCallThatCantCauseGC scope(masm); 1447 AllowExternalCallThatCantCauseGC scope(masm);
1447 __ PrepareCallCFunction(0, 2, scratch); 1448 __ PrepareCallCFunction(0, 2, scratch);
1448 __ MovToFloatParameters(double_base, double_exponent); 1449 __ MovToFloatParameters(double_base, double_exponent);
1449 __ CallCFunction( 1450 __ CallCFunction(
1450 ExternalReference::power_double_double_function(masm->isolate()), 1451 ExternalReference::power_double_double_function(isolate()),
1451 0, 2); 1452 0, 2);
1452 } 1453 }
1453 __ pop(lr); 1454 __ pop(lr);
1454 __ MovFromFloatResult(double_result); 1455 __ MovFromFloatResult(double_result);
1455 1456
1456 __ bind(&done); 1457 __ bind(&done);
1457 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2); 1458 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2);
1458 __ Ret(); 1459 __ Ret();
1459 } 1460 }
1460 } 1461 }
(...skipping 11 matching lines...) Expand all
1472 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); 1473 StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
1473 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 1474 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
1474 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); 1475 CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
1475 BinaryOpICStub::GenerateAheadOfTime(isolate); 1476 BinaryOpICStub::GenerateAheadOfTime(isolate);
1476 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); 1477 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
1477 } 1478 }
1478 1479
1479 1480
1480 void CodeStub::GenerateFPStubs(Isolate* isolate) { 1481 void CodeStub::GenerateFPStubs(Isolate* isolate) {
1481 SaveFPRegsMode mode = kSaveFPRegs; 1482 SaveFPRegsMode mode = kSaveFPRegs;
1482 CEntryStub save_doubles(1, mode); 1483 CEntryStub save_doubles(isolate, 1, mode);
1483 StoreBufferOverflowStub stub(mode); 1484 StoreBufferOverflowStub stub(isolate, mode);
1484 // These stubs might already be in the snapshot, detect that and don't 1485 // These stubs might already be in the snapshot, detect that and don't
1485 // regenerate, which would lead to code stub initialization state being messed 1486 // regenerate, which would lead to code stub initialization state being messed
1486 // up. 1487 // up.
1487 Code* save_doubles_code; 1488 Code* save_doubles_code;
1488 if (!save_doubles.FindCodeInCache(&save_doubles_code, isolate)) { 1489 if (!save_doubles.FindCodeInCache(&save_doubles_code, isolate)) {
1489 save_doubles_code = *save_doubles.GetCode(isolate); 1490 save_doubles_code = *save_doubles.GetCode(isolate);
1490 } 1491 }
1491 Code* store_buffer_overflow_code; 1492 Code* store_buffer_overflow_code;
1492 if (!stub.FindCodeInCache(&store_buffer_overflow_code, isolate)) { 1493 if (!stub.FindCodeInCache(&store_buffer_overflow_code, isolate)) {
1493 store_buffer_overflow_code = *stub.GetCode(isolate); 1494 store_buffer_overflow_code = *stub.GetCode(isolate);
1494 } 1495 }
1495 isolate->set_fp_stubs_generated(true); 1496 isolate->set_fp_stubs_generated(true);
1496 } 1497 }
1497 1498
1498 1499
1499 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { 1500 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) {
1500 CEntryStub stub(1, kDontSaveFPRegs); 1501 CEntryStub stub(isolate, 1, kDontSaveFPRegs);
1501 stub.GetCode(isolate); 1502 stub.GetCode(isolate);
1502 } 1503 }
1503 1504
1504 1505
1505 void CEntryStub::Generate(MacroAssembler* masm) { 1506 void CEntryStub::Generate(MacroAssembler* masm) {
1506 // Called from JavaScript; parameters are on stack as if calling JS function. 1507 // Called from JavaScript; parameters are on stack as if calling JS function.
1507 // r0: number of arguments including receiver 1508 // r0: number of arguments including receiver
1508 // r1: pointer to builtin function 1509 // r1: pointer to builtin function
1509 // fp: frame pointer (restored after C call) 1510 // fp: frame pointer (restored after C call)
1510 // sp: stack pointer (restored as callee's sp after C call) 1511 // sp: stack pointer (restored as callee's sp after C call)
(...skipping 13 matching lines...) Expand all
1524 1525
1525 // Store a copy of argc in callee-saved registers for later. 1526 // Store a copy of argc in callee-saved registers for later.
1526 __ mov(r4, Operand(r0)); 1527 __ mov(r4, Operand(r0));
1527 1528
1528 // r0, r4: number of arguments including receiver (C callee-saved) 1529 // r0, r4: number of arguments including receiver (C callee-saved)
1529 // r1: pointer to the first argument (C callee-saved) 1530 // r1: pointer to the first argument (C callee-saved)
1530 // r5: pointer to builtin function (C callee-saved) 1531 // r5: pointer to builtin function (C callee-saved)
1531 1532
1532 // Result returned in r0 or r0+r1 by default. 1533 // Result returned in r0 or r0+r1 by default.
1533 1534
1534 Isolate* isolate = masm->isolate();
1535
1536 #if V8_HOST_ARCH_ARM 1535 #if V8_HOST_ARCH_ARM
1537 int frame_alignment = MacroAssembler::ActivationFrameAlignment(); 1536 int frame_alignment = MacroAssembler::ActivationFrameAlignment();
1538 int frame_alignment_mask = frame_alignment - 1; 1537 int frame_alignment_mask = frame_alignment - 1;
1539 if (FLAG_debug_code) { 1538 if (FLAG_debug_code) {
1540 if (frame_alignment > kPointerSize) { 1539 if (frame_alignment > kPointerSize) {
1541 Label alignment_as_expected; 1540 Label alignment_as_expected;
1542 ASSERT(IsPowerOf2(frame_alignment)); 1541 ASSERT(IsPowerOf2(frame_alignment));
1543 __ tst(sp, Operand(frame_alignment_mask)); 1542 __ tst(sp, Operand(frame_alignment_mask));
1544 __ b(eq, &alignment_as_expected); 1543 __ b(eq, &alignment_as_expected);
1545 // Don't use Check here, as it will call Runtime_Abort re-entering here. 1544 // Don't use Check here, as it will call Runtime_Abort re-entering here.
1546 __ stop("Unexpected alignment"); 1545 __ stop("Unexpected alignment");
1547 __ bind(&alignment_as_expected); 1546 __ bind(&alignment_as_expected);
1548 } 1547 }
1549 } 1548 }
1550 #endif 1549 #endif
1551 1550
1552 // Call C built-in. 1551 // Call C built-in.
1553 // r0 = argc, r1 = argv 1552 // r0 = argc, r1 = argv
1554 __ mov(r2, Operand(ExternalReference::isolate_address(isolate))); 1553 __ mov(r2, Operand(ExternalReference::isolate_address(isolate())));
1555 1554
1556 // To let the GC traverse the return address of the exit frames, we need to 1555 // To let the GC traverse the return address of the exit frames, we need to
1557 // know where the return address is. The CEntryStub is unmovable, so 1556 // know where the return address is. The CEntryStub is unmovable, so
1558 // we can store the address on the stack to be able to find it again and 1557 // we can store the address on the stack to be able to find it again and
1559 // we never have to restore it, because it will not change. 1558 // we never have to restore it, because it will not change.
1560 // Compute the return address in lr to return to after the jump below. Pc is 1559 // Compute the return address in lr to return to after the jump below. Pc is
1561 // already at '+ 8' from the current instruction but return is after three 1560 // already at '+ 8' from the current instruction but return is after three
1562 // instructions so add another 4 to pc to get the return address. 1561 // instructions so add another 4 to pc to get the return address.
1563 { 1562 {
1564 // Prevent literal pool emission before return address. 1563 // Prevent literal pool emission before return address.
(...skipping 14 matching lines...) Expand all
1579 __ stop("The hole escaped"); 1578 __ stop("The hole escaped");
1580 __ bind(&okay); 1579 __ bind(&okay);
1581 } 1580 }
1582 1581
1583 // Check result for exception sentinel. 1582 // Check result for exception sentinel.
1584 Label exception_returned; 1583 Label exception_returned;
1585 __ CompareRoot(r0, Heap::kExceptionRootIndex); 1584 __ CompareRoot(r0, Heap::kExceptionRootIndex);
1586 __ b(eq, &exception_returned); 1585 __ b(eq, &exception_returned);
1587 1586
1588 ExternalReference pending_exception_address( 1587 ExternalReference pending_exception_address(
1589 Isolate::kPendingExceptionAddress, isolate); 1588 Isolate::kPendingExceptionAddress, isolate());
1590 1589
1591 // Check that there is no pending exception, otherwise we 1590 // Check that there is no pending exception, otherwise we
1592 // should have returned the exception sentinel. 1591 // should have returned the exception sentinel.
1593 if (FLAG_debug_code) { 1592 if (FLAG_debug_code) {
1594 Label okay; 1593 Label okay;
1595 __ mov(r2, Operand(pending_exception_address)); 1594 __ mov(r2, Operand(pending_exception_address));
1596 __ ldr(r2, MemOperand(r2)); 1595 __ ldr(r2, MemOperand(r2));
1597 __ CompareRoot(r2, Heap::kTheHoleValueRootIndex); 1596 __ CompareRoot(r2, Heap::kTheHoleValueRootIndex);
1598 // Cannot use check here as it attempts to generate call into runtime. 1597 // Cannot use check here as it attempts to generate call into runtime.
1599 __ b(eq, &okay); 1598 __ b(eq, &okay);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 int offset_to_argv = (kNumCalleeSaved + 1) * kPointerSize; 1665 int offset_to_argv = (kNumCalleeSaved + 1) * kPointerSize;
1667 offset_to_argv += kNumDoubleCalleeSaved * kDoubleSize; 1666 offset_to_argv += kNumDoubleCalleeSaved * kDoubleSize;
1668 __ ldr(r4, MemOperand(sp, offset_to_argv)); 1667 __ ldr(r4, MemOperand(sp, offset_to_argv));
1669 1668
1670 // Push a frame with special values setup to mark it as an entry frame. 1669 // Push a frame with special values setup to mark it as an entry frame.
1671 // r0: code entry 1670 // r0: code entry
1672 // r1: function 1671 // r1: function
1673 // r2: receiver 1672 // r2: receiver
1674 // r3: argc 1673 // r3: argc
1675 // r4: argv 1674 // r4: argv
1676 Isolate* isolate = masm->isolate();
1677 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; 1675 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
1678 if (FLAG_enable_ool_constant_pool) { 1676 if (FLAG_enable_ool_constant_pool) {
1679 __ mov(r8, Operand(isolate->factory()->empty_constant_pool_array())); 1677 __ mov(r8, Operand(isolate()->factory()->empty_constant_pool_array()));
1680 } 1678 }
1681 __ mov(r7, Operand(Smi::FromInt(marker))); 1679 __ mov(r7, Operand(Smi::FromInt(marker)));
1682 __ mov(r6, Operand(Smi::FromInt(marker))); 1680 __ mov(r6, Operand(Smi::FromInt(marker)));
1683 __ mov(r5, 1681 __ mov(r5,
1684 Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate))); 1682 Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate())));
1685 __ ldr(r5, MemOperand(r5)); 1683 __ ldr(r5, MemOperand(r5));
1686 __ mov(ip, Operand(-1)); // Push a bad frame pointer to fail if it is used. 1684 __ mov(ip, Operand(-1)); // Push a bad frame pointer to fail if it is used.
1687 __ stm(db_w, sp, r5.bit() | r6.bit() | r7.bit() | 1685 __ stm(db_w, sp, r5.bit() | r6.bit() | r7.bit() |
1688 (FLAG_enable_ool_constant_pool ? r8.bit() : 0) | 1686 (FLAG_enable_ool_constant_pool ? r8.bit() : 0) |
1689 ip.bit()); 1687 ip.bit());
1690 1688
1691 // Set up frame pointer for the frame to be pushed. 1689 // Set up frame pointer for the frame to be pushed.
1692 __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); 1690 __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset));
1693 1691
1694 // If this is the outermost JS call, set js_entry_sp value. 1692 // If this is the outermost JS call, set js_entry_sp value.
1695 Label non_outermost_js; 1693 Label non_outermost_js;
1696 ExternalReference js_entry_sp(Isolate::kJSEntrySPAddress, isolate); 1694 ExternalReference js_entry_sp(Isolate::kJSEntrySPAddress, isolate());
1697 __ mov(r5, Operand(ExternalReference(js_entry_sp))); 1695 __ mov(r5, Operand(ExternalReference(js_entry_sp)));
1698 __ ldr(r6, MemOperand(r5)); 1696 __ ldr(r6, MemOperand(r5));
1699 __ cmp(r6, Operand::Zero()); 1697 __ cmp(r6, Operand::Zero());
1700 __ b(ne, &non_outermost_js); 1698 __ b(ne, &non_outermost_js);
1701 __ str(fp, MemOperand(r5)); 1699 __ str(fp, MemOperand(r5));
1702 __ mov(ip, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); 1700 __ mov(ip, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)));
1703 Label cont; 1701 Label cont;
1704 __ b(&cont); 1702 __ b(&cont);
1705 __ bind(&non_outermost_js); 1703 __ bind(&non_outermost_js);
1706 __ mov(ip, Operand(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME))); 1704 __ mov(ip, Operand(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME)));
1707 __ bind(&cont); 1705 __ bind(&cont);
1708 __ push(ip); 1706 __ push(ip);
1709 1707
1710 // Jump to a faked try block that does the invoke, with a faked catch 1708 // Jump to a faked try block that does the invoke, with a faked catch
1711 // block that sets the pending exception. 1709 // block that sets the pending exception.
1712 __ jmp(&invoke); 1710 __ jmp(&invoke);
1713 1711
1714 // Block literal pool emission whilst taking the position of the handler 1712 // Block literal pool emission whilst taking the position of the handler
1715 // entry. This avoids making the assumption that literal pools are always 1713 // entry. This avoids making the assumption that literal pools are always
1716 // emitted after an instruction is emitted, rather than before. 1714 // emitted after an instruction is emitted, rather than before.
1717 { 1715 {
1718 Assembler::BlockConstPoolScope block_const_pool(masm); 1716 Assembler::BlockConstPoolScope block_const_pool(masm);
1719 __ bind(&handler_entry); 1717 __ bind(&handler_entry);
1720 handler_offset_ = handler_entry.pos(); 1718 handler_offset_ = handler_entry.pos();
1721 // Caught exception: Store result (exception) in the pending exception 1719 // Caught exception: Store result (exception) in the pending exception
1722 // field in the JSEnv and return a failure sentinel. Coming in here the 1720 // field in the JSEnv and return a failure sentinel. Coming in here the
1723 // fp will be invalid because the PushTryHandler below sets it to 0 to 1721 // fp will be invalid because the PushTryHandler below sets it to 0 to
1724 // signal the existence of the JSEntry frame. 1722 // signal the existence of the JSEntry frame.
1725 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, 1723 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress,
1726 isolate))); 1724 isolate())));
1727 } 1725 }
1728 __ str(r0, MemOperand(ip)); 1726 __ str(r0, MemOperand(ip));
1729 __ LoadRoot(r0, Heap::kExceptionRootIndex); 1727 __ LoadRoot(r0, Heap::kExceptionRootIndex);
1730 __ b(&exit); 1728 __ b(&exit);
1731 1729
1732 // Invoke: Link this frame into the handler chain. There's only one 1730 // Invoke: Link this frame into the handler chain. There's only one
1733 // handler block in this code object, so its index is 0. 1731 // handler block in this code object, so its index is 0.
1734 __ bind(&invoke); 1732 __ bind(&invoke);
1735 // Must preserve r0-r4, r5-r6 are available. 1733 // Must preserve r0-r4, r5-r6 are available.
1736 __ PushTryHandler(StackHandler::JS_ENTRY, 0); 1734 __ PushTryHandler(StackHandler::JS_ENTRY, 0);
1737 // If an exception not caught by another handler occurs, this handler 1735 // If an exception not caught by another handler occurs, this handler
1738 // returns control to the code after the bl(&invoke) above, which 1736 // returns control to the code after the bl(&invoke) above, which
1739 // restores all kCalleeSaved registers (including cp and fp) to their 1737 // restores all kCalleeSaved registers (including cp and fp) to their
1740 // saved values before returning a failure to C. 1738 // saved values before returning a failure to C.
1741 1739
1742 // Clear any pending exceptions. 1740 // Clear any pending exceptions.
1743 __ mov(r5, Operand(isolate->factory()->the_hole_value())); 1741 __ mov(r5, Operand(isolate()->factory()->the_hole_value()));
1744 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, 1742 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress,
1745 isolate))); 1743 isolate())));
1746 __ str(r5, MemOperand(ip)); 1744 __ str(r5, MemOperand(ip));
1747 1745
1748 // Invoke the function by calling through JS entry trampoline builtin. 1746 // Invoke the function by calling through JS entry trampoline builtin.
1749 // Notice that we cannot store a reference to the trampoline code directly in 1747 // Notice that we cannot store a reference to the trampoline code directly in
1750 // this stub, because runtime stubs are not traversed when doing GC. 1748 // this stub, because runtime stubs are not traversed when doing GC.
1751 1749
1752 // Expected registers by Builtins::JSEntryTrampoline 1750 // Expected registers by Builtins::JSEntryTrampoline
1753 // r0: code entry 1751 // r0: code entry
1754 // r1: function 1752 // r1: function
1755 // r2: receiver 1753 // r2: receiver
1756 // r3: argc 1754 // r3: argc
1757 // r4: argv 1755 // r4: argv
1758 if (is_construct) { 1756 if (is_construct) {
1759 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline, 1757 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline,
1760 isolate); 1758 isolate());
1761 __ mov(ip, Operand(construct_entry)); 1759 __ mov(ip, Operand(construct_entry));
1762 } else { 1760 } else {
1763 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate); 1761 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate());
1764 __ mov(ip, Operand(entry)); 1762 __ mov(ip, Operand(entry));
1765 } 1763 }
1766 __ ldr(ip, MemOperand(ip)); // deref address 1764 __ ldr(ip, MemOperand(ip)); // deref address
1767 __ add(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); 1765 __ add(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag));
1768 1766
1769 // Branch and link to JSEntryTrampoline. 1767 // Branch and link to JSEntryTrampoline.
1770 __ Call(ip); 1768 __ Call(ip);
1771 1769
1772 // Unlink this frame from the handler chain. 1770 // Unlink this frame from the handler chain.
1773 __ PopTryHandler(); 1771 __ PopTryHandler();
1774 1772
1775 __ bind(&exit); // r0 holds result 1773 __ bind(&exit); // r0 holds result
1776 // Check if the current stack frame is marked as the outermost JS frame. 1774 // Check if the current stack frame is marked as the outermost JS frame.
1777 Label non_outermost_js_2; 1775 Label non_outermost_js_2;
1778 __ pop(r5); 1776 __ pop(r5);
1779 __ cmp(r5, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); 1777 __ cmp(r5, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)));
1780 __ b(ne, &non_outermost_js_2); 1778 __ b(ne, &non_outermost_js_2);
1781 __ mov(r6, Operand::Zero()); 1779 __ mov(r6, Operand::Zero());
1782 __ mov(r5, Operand(ExternalReference(js_entry_sp))); 1780 __ mov(r5, Operand(ExternalReference(js_entry_sp)));
1783 __ str(r6, MemOperand(r5)); 1781 __ str(r6, MemOperand(r5));
1784 __ bind(&non_outermost_js_2); 1782 __ bind(&non_outermost_js_2);
1785 1783
1786 // Restore the top frame descriptors from the stack. 1784 // Restore the top frame descriptors from the stack.
1787 __ pop(r3); 1785 __ pop(r3);
1788 __ mov(ip, 1786 __ mov(ip,
1789 Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate))); 1787 Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate())));
1790 __ str(r3, MemOperand(ip)); 1788 __ str(r3, MemOperand(ip));
1791 1789
1792 // Reset the stack to the callee saved registers. 1790 // Reset the stack to the callee saved registers.
1793 __ add(sp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); 1791 __ add(sp, sp, Operand(-EntryFrameConstants::kCallerFPOffset));
1794 1792
1795 // Restore callee-saved registers and return. 1793 // Restore callee-saved registers and return.
1796 #ifdef DEBUG 1794 #ifdef DEBUG
1797 if (FLAG_debug_code) { 1795 if (FLAG_debug_code) {
1798 __ mov(lr, Operand(pc)); 1796 __ mov(lr, Operand(pc));
1799 } 1797 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 1936
1939 Label object_not_null, object_not_null_or_smi; 1937 Label object_not_null, object_not_null_or_smi;
1940 __ bind(&not_js_object); 1938 __ bind(&not_js_object);
1941 // Before null, smi and string value checks, check that the rhs is a function 1939 // Before null, smi and string value checks, check that the rhs is a function
1942 // as for a non-function rhs an exception needs to be thrown. 1940 // as for a non-function rhs an exception needs to be thrown.
1943 __ JumpIfSmi(function, &slow); 1941 __ JumpIfSmi(function, &slow);
1944 __ CompareObjectType(function, scratch2, scratch, JS_FUNCTION_TYPE); 1942 __ CompareObjectType(function, scratch2, scratch, JS_FUNCTION_TYPE);
1945 __ b(ne, &slow); 1943 __ b(ne, &slow);
1946 1944
1947 // Null is not instance of anything. 1945 // Null is not instance of anything.
1948 __ cmp(scratch, Operand(masm->isolate()->factory()->null_value())); 1946 __ cmp(scratch, Operand(isolate()->factory()->null_value()));
1949 __ b(ne, &object_not_null); 1947 __ b(ne, &object_not_null);
1950 __ mov(r0, Operand(Smi::FromInt(1))); 1948 __ mov(r0, Operand(Smi::FromInt(1)));
1951 __ Ret(HasArgsInRegisters() ? 0 : 2); 1949 __ Ret(HasArgsInRegisters() ? 0 : 2);
1952 1950
1953 __ bind(&object_not_null); 1951 __ bind(&object_not_null);
1954 // Smi values are not instances of anything. 1952 // Smi values are not instances of anything.
1955 __ JumpIfNotSmi(object, &object_not_null_or_smi); 1953 __ JumpIfNotSmi(object, &object_not_null_or_smi);
1956 __ mov(r0, Operand(Smi::FromInt(1))); 1954 __ mov(r0, Operand(Smi::FromInt(1)));
1957 __ Ret(HasArgsInRegisters() ? 0 : 2); 1955 __ Ret(HasArgsInRegisters() ? 0 : 2);
1958 1956
(...skipping 26 matching lines...) Expand all
1985 1983
1986 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { 1984 void FunctionPrototypeStub::Generate(MacroAssembler* masm) {
1987 Label miss; 1985 Label miss;
1988 Register receiver; 1986 Register receiver;
1989 if (kind() == Code::KEYED_LOAD_IC) { 1987 if (kind() == Code::KEYED_LOAD_IC) {
1990 // ----------- S t a t e ------------- 1988 // ----------- S t a t e -------------
1991 // -- lr : return address 1989 // -- lr : return address
1992 // -- r0 : key 1990 // -- r0 : key
1993 // -- r1 : receiver 1991 // -- r1 : receiver
1994 // ----------------------------------- 1992 // -----------------------------------
1995 __ cmp(r0, Operand(masm->isolate()->factory()->prototype_string())); 1993 __ cmp(r0, Operand(isolate()->factory()->prototype_string()));
1996 __ b(ne, &miss); 1994 __ b(ne, &miss);
1997 receiver = r1; 1995 receiver = r1;
1998 } else { 1996 } else {
1999 ASSERT(kind() == Code::LOAD_IC); 1997 ASSERT(kind() == Code::LOAD_IC);
2000 // ----------- S t a t e ------------- 1998 // ----------- S t a t e -------------
2001 // -- r2 : name 1999 // -- r2 : name
2002 // -- lr : return address 2000 // -- lr : return address
2003 // -- r0 : receiver 2001 // -- r0 : receiver
2004 // -- sp[0] : receiver 2002 // -- sp[0] : receiver
2005 // ----------------------------------- 2003 // -----------------------------------
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
2415 // Allocation of registers for this function. These are in callee save 2413 // Allocation of registers for this function. These are in callee save
2416 // registers and will be preserved by the call to the native RegExp code, as 2414 // registers and will be preserved by the call to the native RegExp code, as
2417 // this code is called using the normal C calling convention. When calling 2415 // this code is called using the normal C calling convention. When calling
2418 // directly from generated code the native RegExp code will not do a GC and 2416 // directly from generated code the native RegExp code will not do a GC and
2419 // therefore the content of these registers are safe to use after the call. 2417 // therefore the content of these registers are safe to use after the call.
2420 Register subject = r4; 2418 Register subject = r4;
2421 Register regexp_data = r5; 2419 Register regexp_data = r5;
2422 Register last_match_info_elements = no_reg; // will be r6; 2420 Register last_match_info_elements = no_reg; // will be r6;
2423 2421
2424 // Ensure that a RegExp stack is allocated. 2422 // Ensure that a RegExp stack is allocated.
2425 Isolate* isolate = masm->isolate();
2426 ExternalReference address_of_regexp_stack_memory_address = 2423 ExternalReference address_of_regexp_stack_memory_address =
2427 ExternalReference::address_of_regexp_stack_memory_address(isolate); 2424 ExternalReference::address_of_regexp_stack_memory_address(isolate());
2428 ExternalReference address_of_regexp_stack_memory_size = 2425 ExternalReference address_of_regexp_stack_memory_size =
2429 ExternalReference::address_of_regexp_stack_memory_size(isolate); 2426 ExternalReference::address_of_regexp_stack_memory_size(isolate());
2430 __ mov(r0, Operand(address_of_regexp_stack_memory_size)); 2427 __ mov(r0, Operand(address_of_regexp_stack_memory_size));
2431 __ ldr(r0, MemOperand(r0, 0)); 2428 __ ldr(r0, MemOperand(r0, 0));
2432 __ cmp(r0, Operand::Zero()); 2429 __ cmp(r0, Operand::Zero());
2433 __ b(eq, &runtime); 2430 __ b(eq, &runtime);
2434 2431
2435 // Check that the first argument is a JSRegExp object. 2432 // Check that the first argument is a JSRegExp object.
2436 __ ldr(r0, MemOperand(sp, kJSRegExpOffset)); 2433 __ ldr(r0, MemOperand(sp, kJSRegExpOffset));
2437 __ JumpIfSmi(r0, &runtime); 2434 __ JumpIfSmi(r0, &runtime);
2438 __ CompareObjectType(r0, r1, r1, JS_REGEXP_TYPE); 2435 __ CompareObjectType(r0, r1, r1, JS_REGEXP_TYPE);
2439 __ b(ne, &runtime); 2436 __ b(ne, &runtime);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 // encoding. If it has, the field contains a code object otherwise it contains 2558 // encoding. If it has, the field contains a code object otherwise it contains
2562 // a smi (code flushing support). 2559 // a smi (code flushing support).
2563 __ JumpIfSmi(r6, &runtime); 2560 __ JumpIfSmi(r6, &runtime);
2564 2561
2565 // r1: previous index 2562 // r1: previous index
2566 // r3: encoding of subject string (1 if ASCII, 0 if two_byte); 2563 // r3: encoding of subject string (1 if ASCII, 0 if two_byte);
2567 // r6: code 2564 // r6: code
2568 // subject: Subject string 2565 // subject: Subject string
2569 // regexp_data: RegExp data (FixedArray) 2566 // regexp_data: RegExp data (FixedArray)
2570 // All checks done. Now push arguments for native regexp code. 2567 // All checks done. Now push arguments for native regexp code.
2571 __ IncrementCounter(isolate->counters()->regexp_entry_native(), 1, r0, r2); 2568 __ IncrementCounter(isolate()->counters()->regexp_entry_native(), 1, r0, r2);
2572 2569
2573 // Isolates: note we add an additional parameter here (isolate pointer). 2570 // Isolates: note we add an additional parameter here (isolate pointer).
2574 const int kRegExpExecuteArguments = 9; 2571 const int kRegExpExecuteArguments = 9;
2575 const int kParameterRegisters = 4; 2572 const int kParameterRegisters = 4;
2576 __ EnterExitFrame(false, kRegExpExecuteArguments - kParameterRegisters); 2573 __ EnterExitFrame(false, kRegExpExecuteArguments - kParameterRegisters);
2577 2574
2578 // Stack pointer now points to cell where return address is to be written. 2575 // Stack pointer now points to cell where return address is to be written.
2579 // Arguments are before that on the stack or in registers. 2576 // Arguments are before that on the stack or in registers.
2580 2577
2581 // Argument 9 (sp[20]): Pass current isolate address. 2578 // Argument 9 (sp[20]): Pass current isolate address.
2582 __ mov(r0, Operand(ExternalReference::isolate_address(isolate))); 2579 __ mov(r0, Operand(ExternalReference::isolate_address(isolate())));
2583 __ str(r0, MemOperand(sp, 5 * kPointerSize)); 2580 __ str(r0, MemOperand(sp, 5 * kPointerSize));
2584 2581
2585 // Argument 8 (sp[16]): Indicate that this is a direct call from JavaScript. 2582 // Argument 8 (sp[16]): Indicate that this is a direct call from JavaScript.
2586 __ mov(r0, Operand(1)); 2583 __ mov(r0, Operand(1));
2587 __ str(r0, MemOperand(sp, 4 * kPointerSize)); 2584 __ str(r0, MemOperand(sp, 4 * kPointerSize));
2588 2585
2589 // Argument 7 (sp[12]): Start (high end) of backtracking stack memory area. 2586 // Argument 7 (sp[12]): Start (high end) of backtracking stack memory area.
2590 __ mov(r0, Operand(address_of_regexp_stack_memory_address)); 2587 __ mov(r0, Operand(address_of_regexp_stack_memory_address));
2591 __ ldr(r0, MemOperand(r0, 0)); 2588 __ ldr(r0, MemOperand(r0, 0));
2592 __ mov(r2, Operand(address_of_regexp_stack_memory_size)); 2589 __ mov(r2, Operand(address_of_regexp_stack_memory_size));
2593 __ ldr(r2, MemOperand(r2, 0)); 2590 __ ldr(r2, MemOperand(r2, 0));
2594 __ add(r0, r0, Operand(r2)); 2591 __ add(r0, r0, Operand(r2));
2595 __ str(r0, MemOperand(sp, 3 * kPointerSize)); 2592 __ str(r0, MemOperand(sp, 3 * kPointerSize));
2596 2593
2597 // Argument 6: Set the number of capture registers to zero to force global 2594 // Argument 6: Set the number of capture registers to zero to force global
2598 // regexps to behave as non-global. This does not affect non-global regexps. 2595 // regexps to behave as non-global. This does not affect non-global regexps.
2599 __ mov(r0, Operand::Zero()); 2596 __ mov(r0, Operand::Zero());
2600 __ str(r0, MemOperand(sp, 2 * kPointerSize)); 2597 __ str(r0, MemOperand(sp, 2 * kPointerSize));
2601 2598
2602 // Argument 5 (sp[4]): static offsets vector buffer. 2599 // Argument 5 (sp[4]): static offsets vector buffer.
2603 __ mov(r0, 2600 __ mov(r0,
2604 Operand(ExternalReference::address_of_static_offsets_vector(isolate))); 2601 Operand(ExternalReference::address_of_static_offsets_vector(
2602 isolate())));
2605 __ str(r0, MemOperand(sp, 1 * kPointerSize)); 2603 __ str(r0, MemOperand(sp, 1 * kPointerSize));
2606 2604
2607 // For arguments 4 and 3 get string length, calculate start of string data and 2605 // For arguments 4 and 3 get string length, calculate start of string data and
2608 // calculate the shift of the index (0 for ASCII and 1 for two byte). 2606 // calculate the shift of the index (0 for ASCII and 1 for two byte).
2609 __ add(r7, subject, Operand(SeqString::kHeaderSize - kHeapObjectTag)); 2607 __ add(r7, subject, Operand(SeqString::kHeaderSize - kHeapObjectTag));
2610 __ eor(r3, r3, Operand(1)); 2608 __ eor(r3, r3, Operand(1));
2611 // Load the length from the original subject string from the previous stack 2609 // Load the length from the original subject string from the previous stack
2612 // frame. Therefore we have to use fp, which points exactly to two pointer 2610 // frame. Therefore we have to use fp, which points exactly to two pointer
2613 // sizes below the previous sp. (Because creating a new stack frame pushes 2611 // sizes below the previous sp. (Because creating a new stack frame pushes
2614 // the previous fp onto the stack and moves up sp by 2 * kPointerSize.) 2612 // the previous fp onto the stack and moves up sp by 2 * kPointerSize.)
(...skipping 10 matching lines...) Expand all
2625 __ add(r3, r9, Operand(r7, LSL, r3)); 2623 __ add(r3, r9, Operand(r7, LSL, r3));
2626 2624
2627 // Argument 2 (r1): Previous index. 2625 // Argument 2 (r1): Previous index.
2628 // Already there 2626 // Already there
2629 2627
2630 // Argument 1 (r0): Subject string. 2628 // Argument 1 (r0): Subject string.
2631 __ mov(r0, subject); 2629 __ mov(r0, subject);
2632 2630
2633 // Locate the code entry and call it. 2631 // Locate the code entry and call it.
2634 __ add(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); 2632 __ add(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag));
2635 DirectCEntryStub stub; 2633 DirectCEntryStub stub(isolate());
2636 stub.GenerateCall(masm, r6); 2634 stub.GenerateCall(masm, r6);
2637 2635
2638 __ LeaveExitFrame(false, no_reg, true); 2636 __ LeaveExitFrame(false, no_reg, true);
2639 2637
2640 last_match_info_elements = r6; 2638 last_match_info_elements = r6;
2641 2639
2642 // r0: result 2640 // r0: result
2643 // subject: subject string (callee saved) 2641 // subject: subject string (callee saved)
2644 // regexp_data: RegExp data (callee saved) 2642 // regexp_data: RegExp data (callee saved)
2645 // last_match_info_elements: Last match info elements (callee saved) 2643 // last_match_info_elements: Last match info elements (callee saved)
2646 // Check the result. 2644 // Check the result.
2647 Label success; 2645 Label success;
2648 __ cmp(r0, Operand(1)); 2646 __ cmp(r0, Operand(1));
2649 // We expect exactly one result since we force the called regexp to behave 2647 // We expect exactly one result since we force the called regexp to behave
2650 // as non-global. 2648 // as non-global.
2651 __ b(eq, &success); 2649 __ b(eq, &success);
2652 Label failure; 2650 Label failure;
2653 __ cmp(r0, Operand(NativeRegExpMacroAssembler::FAILURE)); 2651 __ cmp(r0, Operand(NativeRegExpMacroAssembler::FAILURE));
2654 __ b(eq, &failure); 2652 __ b(eq, &failure);
2655 __ cmp(r0, Operand(NativeRegExpMacroAssembler::EXCEPTION)); 2653 __ cmp(r0, Operand(NativeRegExpMacroAssembler::EXCEPTION));
2656 // If not exception it can only be retry. Handle that in the runtime system. 2654 // If not exception it can only be retry. Handle that in the runtime system.
2657 __ b(ne, &runtime); 2655 __ b(ne, &runtime);
2658 // Result must now be exception. If there is no pending exception already a 2656 // Result must now be exception. If there is no pending exception already a
2659 // stack overflow (on the backtrack stack) was detected in RegExp code but 2657 // stack overflow (on the backtrack stack) was detected in RegExp code but
2660 // haven't created the exception yet. Handle that in the runtime system. 2658 // haven't created the exception yet. Handle that in the runtime system.
2661 // TODO(592): Rerunning the RegExp to get the stack overflow exception. 2659 // TODO(592): Rerunning the RegExp to get the stack overflow exception.
2662 __ mov(r1, Operand(isolate->factory()->the_hole_value())); 2660 __ mov(r1, Operand(isolate()->factory()->the_hole_value()));
2663 __ mov(r2, Operand(ExternalReference(Isolate::kPendingExceptionAddress, 2661 __ mov(r2, Operand(ExternalReference(Isolate::kPendingExceptionAddress,
2664 isolate))); 2662 isolate())));
2665 __ ldr(r0, MemOperand(r2, 0)); 2663 __ ldr(r0, MemOperand(r2, 0));
2666 __ cmp(r0, r1); 2664 __ cmp(r0, r1);
2667 __ b(eq, &runtime); 2665 __ b(eq, &runtime);
2668 2666
2669 __ str(r1, MemOperand(r2, 0)); // Clear pending exception. 2667 __ str(r1, MemOperand(r2, 0)); // Clear pending exception.
2670 2668
2671 // Check if the exception is a termination. If so, throw as uncatchable. 2669 // Check if the exception is a termination. If so, throw as uncatchable.
2672 __ CompareRoot(r0, Heap::kTerminationExceptionRootIndex); 2670 __ CompareRoot(r0, Heap::kTerminationExceptionRootIndex);
2673 2671
2674 Label termination_exception; 2672 Label termination_exception;
2675 __ b(eq, &termination_exception); 2673 __ b(eq, &termination_exception);
2676 2674
2677 __ Throw(r0); 2675 __ Throw(r0);
2678 2676
2679 __ bind(&termination_exception); 2677 __ bind(&termination_exception);
2680 __ ThrowUncatchable(r0); 2678 __ ThrowUncatchable(r0);
2681 2679
2682 __ bind(&failure); 2680 __ bind(&failure);
2683 // For failure and exception return null. 2681 // For failure and exception return null.
2684 __ mov(r0, Operand(masm->isolate()->factory()->null_value())); 2682 __ mov(r0, Operand(isolate()->factory()->null_value()));
2685 __ add(sp, sp, Operand(4 * kPointerSize)); 2683 __ add(sp, sp, Operand(4 * kPointerSize));
2686 __ Ret(); 2684 __ Ret();
2687 2685
2688 // Process the result from the native regexp code. 2686 // Process the result from the native regexp code.
2689 __ bind(&success); 2687 __ bind(&success);
2690 __ ldr(r1, 2688 __ ldr(r1,
2691 FieldMemOperand(regexp_data, JSRegExp::kIrregexpCaptureCountOffset)); 2689 FieldMemOperand(regexp_data, JSRegExp::kIrregexpCaptureCountOffset));
2692 // Calculate number of capture registers (number_of_captures + 1) * 2. 2690 // Calculate number of capture registers (number_of_captures + 1) * 2.
2693 // Multiplying by 2 comes for free since r1 is smi-tagged. 2691 // Multiplying by 2 comes for free since r1 is smi-tagged.
2694 STATIC_ASSERT(kSmiTag == 0); 2692 STATIC_ASSERT(kSmiTag == 0);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 RegExpImpl::kLastInputOffset)); 2734 RegExpImpl::kLastInputOffset));
2737 __ RecordWriteField(last_match_info_elements, 2735 __ RecordWriteField(last_match_info_elements,
2738 RegExpImpl::kLastInputOffset, 2736 RegExpImpl::kLastInputOffset,
2739 subject, 2737 subject,
2740 r3, 2738 r3,
2741 kLRHasNotBeenSaved, 2739 kLRHasNotBeenSaved,
2742 kDontSaveFPRegs); 2740 kDontSaveFPRegs);
2743 2741
2744 // Get the static offsets vector filled by the native regexp code. 2742 // Get the static offsets vector filled by the native regexp code.
2745 ExternalReference address_of_static_offsets_vector = 2743 ExternalReference address_of_static_offsets_vector =
2746 ExternalReference::address_of_static_offsets_vector(isolate); 2744 ExternalReference::address_of_static_offsets_vector(isolate());
2747 __ mov(r2, Operand(address_of_static_offsets_vector)); 2745 __ mov(r2, Operand(address_of_static_offsets_vector));
2748 2746
2749 // r1: number of capture registers 2747 // r1: number of capture registers
2750 // r2: offsets vector 2748 // r2: offsets vector
2751 Label next_capture, done; 2749 Label next_capture, done;
2752 // Capture register counter starts from number of capture registers and 2750 // Capture register counter starts from number of capture registers and
2753 // counts down until wraping after zero. 2751 // counts down until wraping after zero.
2754 __ add(r0, 2752 __ add(r0,
2755 last_match_info_elements, 2753 last_match_info_elements,
2756 Operand(RegExpImpl::kFirstCaptureOffset - kHeapObjectTag)); 2754 Operand(RegExpImpl::kFirstCaptureOffset - kHeapObjectTag));
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2881 // The target function is the Array constructor, 2879 // The target function is the Array constructor,
2882 // Create an AllocationSite if we don't already have it, store it in the 2880 // Create an AllocationSite if we don't already have it, store it in the
2883 // slot. 2881 // slot.
2884 { 2882 {
2885 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 2883 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
2886 2884
2887 // Arguments register must be smi-tagged to call out. 2885 // Arguments register must be smi-tagged to call out.
2888 __ SmiTag(r0); 2886 __ SmiTag(r0);
2889 __ Push(r3, r2, r1, r0); 2887 __ Push(r3, r2, r1, r0);
2890 2888
2891 CreateAllocationSiteStub create_stub; 2889 CreateAllocationSiteStub create_stub(masm->isolate());
2892 __ CallStub(&create_stub); 2890 __ CallStub(&create_stub);
2893 2891
2894 __ Pop(r3, r2, r1, r0); 2892 __ Pop(r3, r2, r1, r0);
2895 __ SmiUntag(r0); 2893 __ SmiUntag(r0);
2896 } 2894 }
2897 __ b(&done); 2895 __ b(&done);
2898 2896
2899 __ bind(&not_array_function); 2897 __ bind(&not_array_function);
2900 } 2898 }
2901 2899
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2970 } 2968 }
2971 __ InvokeFunction(r1, actual, JUMP_FUNCTION, NullCallWrapper()); 2969 __ InvokeFunction(r1, actual, JUMP_FUNCTION, NullCallWrapper());
2972 2970
2973 if (NeedsChecks()) { 2971 if (NeedsChecks()) {
2974 // Slow-case: Non-function called. 2972 // Slow-case: Non-function called.
2975 __ bind(&slow); 2973 __ bind(&slow);
2976 if (RecordCallTarget()) { 2974 if (RecordCallTarget()) {
2977 // If there is a call target cache, mark it megamorphic in the 2975 // If there is a call target cache, mark it megamorphic in the
2978 // non-function case. MegamorphicSentinel is an immortal immovable 2976 // non-function case. MegamorphicSentinel is an immortal immovable
2979 // object (megamorphic symbol) so no write barrier is needed. 2977 // object (megamorphic symbol) so no write barrier is needed.
2980 ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()), 2978 ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(isolate()),
2981 masm->isolate()->heap()->megamorphic_symbol()); 2979 isolate()->heap()->megamorphic_symbol());
2982 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); 2980 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3));
2983 __ LoadRoot(ip, Heap::kMegamorphicSymbolRootIndex); 2981 __ LoadRoot(ip, Heap::kMegamorphicSymbolRootIndex);
2984 __ str(ip, FieldMemOperand(r5, FixedArray::kHeaderSize)); 2982 __ str(ip, FieldMemOperand(r5, FixedArray::kHeaderSize));
2985 } 2983 }
2986 // Check for function proxy. 2984 // Check for function proxy.
2987 __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE)); 2985 __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE));
2988 __ b(ne, &non_function); 2986 __ b(ne, &non_function);
2989 __ push(r1); // put proxy as additional argument 2987 __ push(r1); // put proxy as additional argument
2990 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE32)); 2988 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE32));
2991 __ mov(r2, Operand::Zero()); 2989 __ mov(r2, Operand::Zero());
2992 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY); 2990 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY);
2993 { 2991 {
2994 Handle<Code> adaptor = 2992 Handle<Code> adaptor =
2995 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); 2993 isolate()->builtins()->ArgumentsAdaptorTrampoline();
2996 __ Jump(adaptor, RelocInfo::CODE_TARGET); 2994 __ Jump(adaptor, RelocInfo::CODE_TARGET);
2997 } 2995 }
2998 2996
2999 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 2997 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
3000 // of the original receiver from the call site). 2998 // of the original receiver from the call site).
3001 __ bind(&non_function); 2999 __ bind(&non_function);
3002 __ str(r1, MemOperand(sp, argc_ * kPointerSize)); 3000 __ str(r1, MemOperand(sp, argc_ * kPointerSize));
3003 __ mov(r0, Operand(argc_)); // Set up the number of arguments. 3001 __ mov(r0, Operand(argc_)); // Set up the number of arguments.
3004 __ mov(r2, Operand::Zero()); 3002 __ mov(r2, Operand::Zero());
3005 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION); 3003 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION);
3006 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 3004 __ Jump(isolate()->builtins()->ArgumentsAdaptorTrampoline(),
3007 RelocInfo::CODE_TARGET); 3005 RelocInfo::CODE_TARGET);
3008 } 3006 }
3009 3007
3010 if (CallAsMethod()) { 3008 if (CallAsMethod()) {
3011 __ bind(&wrap); 3009 __ bind(&wrap);
3012 // Wrap the receiver and patch it back onto the stack. 3010 // Wrap the receiver and patch it back onto the stack.
3013 { FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); 3011 { FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL);
3014 __ Push(r1, r3); 3012 __ Push(r1, r3);
3015 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 3013 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
3016 __ pop(r1); 3014 __ pop(r1);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
3073 __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE)); 3071 __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE));
3074 __ b(ne, &non_function_call); 3072 __ b(ne, &non_function_call);
3075 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); 3073 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR);
3076 __ jmp(&do_call); 3074 __ jmp(&do_call);
3077 3075
3078 __ bind(&non_function_call); 3076 __ bind(&non_function_call);
3079 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 3077 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
3080 __ bind(&do_call); 3078 __ bind(&do_call);
3081 // Set expected number of arguments to zero (not changing r0). 3079 // Set expected number of arguments to zero (not changing r0).
3082 __ mov(r2, Operand::Zero()); 3080 __ mov(r2, Operand::Zero());
3083 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 3081 __ Jump(isolate()->builtins()->ArgumentsAdaptorTrampoline(),
3084 RelocInfo::CODE_TARGET); 3082 RelocInfo::CODE_TARGET);
3085 } 3083 }
3086 3084
3087 3085
3088 // StringCharCodeAtGenerator 3086 // StringCharCodeAtGenerator
3089 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { 3087 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
3090 Label flat_string; 3088 Label flat_string;
3091 Label ascii_string; 3089 Label ascii_string;
3092 Label got_char_code; 3090 Label got_char_code;
3093 Label sliced_string; 3091 Label sliced_string;
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
3601 3599
3602 // r0: result string. 3600 // r0: result string.
3603 // r1: first character of result. 3601 // r1: first character of result.
3604 // r2: result length. 3602 // r2: result length.
3605 // r5: first character of substring to copy. 3603 // r5: first character of substring to copy.
3606 STATIC_ASSERT((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); 3604 STATIC_ASSERT((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0);
3607 StringHelper::GenerateCopyCharactersLong( 3605 StringHelper::GenerateCopyCharactersLong(
3608 masm, r1, r5, r2, r3, r4, r6, r9, DEST_ALWAYS_ALIGNED); 3606 masm, r1, r5, r2, r3, r4, r6, r9, DEST_ALWAYS_ALIGNED);
3609 3607
3610 __ bind(&return_r0); 3608 __ bind(&return_r0);
3611 Counters* counters = masm->isolate()->counters(); 3609 Counters* counters = isolate()->counters();
3612 __ IncrementCounter(counters->sub_string_native(), 1, r3, r4); 3610 __ IncrementCounter(counters->sub_string_native(), 1, r3, r4);
3613 __ Drop(3); 3611 __ Drop(3);
3614 __ Ret(); 3612 __ Ret();
3615 3613
3616 // Just jump to runtime to create the sub string. 3614 // Just jump to runtime to create the sub string.
3617 __ bind(&runtime); 3615 __ bind(&runtime);
3618 __ TailCallRuntime(Runtime::kHiddenSubString, 3, 1); 3616 __ TailCallRuntime(Runtime::kHiddenSubString, 3, 1);
3619 3617
3620 __ bind(&single_char); 3618 __ bind(&single_char);
3621 // r0: original string 3619 // r0: original string
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
3736 __ cmp(scratch1, scratch2); 3734 __ cmp(scratch1, scratch2);
3737 __ b(ne, chars_not_equal); 3735 __ b(ne, chars_not_equal);
3738 __ add(index, index, Operand(1), SetCC); 3736 __ add(index, index, Operand(1), SetCC);
3739 __ b(ne, &loop); 3737 __ b(ne, &loop);
3740 } 3738 }
3741 3739
3742 3740
3743 void StringCompareStub::Generate(MacroAssembler* masm) { 3741 void StringCompareStub::Generate(MacroAssembler* masm) {
3744 Label runtime; 3742 Label runtime;
3745 3743
3746 Counters* counters = masm->isolate()->counters(); 3744 Counters* counters = isolate()->counters();
3747 3745
3748 // Stack frame on entry. 3746 // Stack frame on entry.
3749 // sp[0]: right string 3747 // sp[0]: right string
3750 // sp[4]: left string 3748 // sp[4]: left string
3751 __ Ldrd(r0 , r1, MemOperand(sp)); // Load right in r0, left in r1. 3749 __ Ldrd(r0 , r1, MemOperand(sp)); // Load right in r0, left in r1.
3752 3750
3753 Label not_same; 3751 Label not_same;
3754 __ cmp(r0, r1); 3752 __ cmp(r0, r1);
3755 __ b(ne, &not_same); 3753 __ b(ne, &not_same);
3756 STATIC_ASSERT(EQUAL == 0); 3754 STATIC_ASSERT(EQUAL == 0);
(...skipping 19 matching lines...) Expand all
3776 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1); 3774 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
3777 } 3775 }
3778 3776
3779 3777
3780 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { 3778 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
3781 // ----------- S t a t e ------------- 3779 // ----------- S t a t e -------------
3782 // -- r1 : left 3780 // -- r1 : left
3783 // -- r0 : right 3781 // -- r0 : right
3784 // -- lr : return address 3782 // -- lr : return address
3785 // ----------------------------------- 3783 // -----------------------------------
3786 Isolate* isolate = masm->isolate();
3787 3784
3788 // Load r2 with the allocation site. We stick an undefined dummy value here 3785 // Load r2 with the allocation site. We stick an undefined dummy value here
3789 // and replace it with the real allocation site later when we instantiate this 3786 // and replace it with the real allocation site later when we instantiate this
3790 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). 3787 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate().
3791 __ Move(r2, handle(isolate->heap()->undefined_value())); 3788 __ Move(r2, handle(isolate()->heap()->undefined_value()));
3792 3789
3793 // Make sure that we actually patched the allocation site. 3790 // Make sure that we actually patched the allocation site.
3794 if (FLAG_debug_code) { 3791 if (FLAG_debug_code) {
3795 __ tst(r2, Operand(kSmiTagMask)); 3792 __ tst(r2, Operand(kSmiTagMask));
3796 __ Assert(ne, kExpectedAllocationSite); 3793 __ Assert(ne, kExpectedAllocationSite);
3797 __ push(r2); 3794 __ push(r2);
3798 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); 3795 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset));
3799 __ LoadRoot(ip, Heap::kAllocationSiteMapRootIndex); 3796 __ LoadRoot(ip, Heap::kAllocationSiteMapRootIndex);
3800 __ cmp(r2, ip); 3797 __ cmp(r2, ip);
3801 __ pop(r2); 3798 __ pop(r2);
3802 __ Assert(eq, kExpectedAllocationSite); 3799 __ Assert(eq, kExpectedAllocationSite);
3803 } 3800 }
3804 3801
3805 // Tail call into the stub that handles binary operations with allocation 3802 // Tail call into the stub that handles binary operations with allocation
3806 // sites. 3803 // sites.
3807 BinaryOpWithAllocationSiteStub stub(state_); 3804 BinaryOpWithAllocationSiteStub stub(isolate(), state_);
3808 __ TailCallStub(&stub); 3805 __ TailCallStub(&stub);
3809 } 3806 }
3810 3807
3811 3808
3812 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { 3809 void ICCompareStub::GenerateSmis(MacroAssembler* masm) {
3813 ASSERT(state_ == CompareIC::SMI); 3810 ASSERT(state_ == CompareIC::SMI);
3814 Label miss; 3811 Label miss;
3815 __ orr(r2, r1, r0); 3812 __ orr(r2, r1, r0);
3816 __ JumpIfNotSmi(r2, &miss); 3813 __ JumpIfNotSmi(r2, &miss);
3817 3814
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3875 __ b(vs, &unordered); 3872 __ b(vs, &unordered);
3876 3873
3877 // Return a result of -1, 0, or 1, based on status bits. 3874 // Return a result of -1, 0, or 1, based on status bits.
3878 __ mov(r0, Operand(EQUAL), LeaveCC, eq); 3875 __ mov(r0, Operand(EQUAL), LeaveCC, eq);
3879 __ mov(r0, Operand(LESS), LeaveCC, lt); 3876 __ mov(r0, Operand(LESS), LeaveCC, lt);
3880 __ mov(r0, Operand(GREATER), LeaveCC, gt); 3877 __ mov(r0, Operand(GREATER), LeaveCC, gt);
3881 __ Ret(); 3878 __ Ret();
3882 3879
3883 __ bind(&unordered); 3880 __ bind(&unordered);
3884 __ bind(&generic_stub); 3881 __ bind(&generic_stub);
3885 ICCompareStub stub(op_, CompareIC::GENERIC, CompareIC::GENERIC, 3882 ICCompareStub stub(isolate(), op_, CompareIC::GENERIC, CompareIC::GENERIC,
3886 CompareIC::GENERIC); 3883 CompareIC::GENERIC);
3887 __ Jump(stub.GetCode(masm->isolate()), RelocInfo::CODE_TARGET); 3884 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET);
3888 3885
3889 __ bind(&maybe_undefined1); 3886 __ bind(&maybe_undefined1);
3890 if (Token::IsOrderedRelationalCompareOp(op_)) { 3887 if (Token::IsOrderedRelationalCompareOp(op_)) {
3891 __ CompareRoot(r0, Heap::kUndefinedValueRootIndex); 3888 __ CompareRoot(r0, Heap::kUndefinedValueRootIndex);
3892 __ b(ne, &miss); 3889 __ b(ne, &miss);
3893 __ JumpIfSmi(r1, &unordered); 3890 __ JumpIfSmi(r1, &unordered);
3894 __ CompareObjectType(r1, r2, r2, HEAP_NUMBER_TYPE); 3891 __ CompareObjectType(r1, r2, r2, HEAP_NUMBER_TYPE);
3895 __ b(ne, &maybe_undefined2); 3892 __ b(ne, &maybe_undefined2);
3896 __ jmp(&unordered); 3893 __ jmp(&unordered);
3897 } 3894 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
4100 __ bind(&miss); 4097 __ bind(&miss);
4101 GenerateMiss(masm); 4098 GenerateMiss(masm);
4102 } 4099 }
4103 4100
4104 4101
4105 4102
4106 void ICCompareStub::GenerateMiss(MacroAssembler* masm) { 4103 void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
4107 { 4104 {
4108 // Call the runtime system in a fresh internal frame. 4105 // Call the runtime system in a fresh internal frame.
4109 ExternalReference miss = 4106 ExternalReference miss =
4110 ExternalReference(IC_Utility(IC::kCompareIC_Miss), masm->isolate()); 4107 ExternalReference(IC_Utility(IC::kCompareIC_Miss), isolate());
4111 4108
4112 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 4109 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
4113 __ Push(r1, r0); 4110 __ Push(r1, r0);
4114 __ Push(lr, r1, r0); 4111 __ Push(lr, r1, r0);
4115 __ mov(ip, Operand(Smi::FromInt(op_))); 4112 __ mov(ip, Operand(Smi::FromInt(op_)));
4116 __ push(ip); 4113 __ push(ip);
4117 __ CallExternalReference(miss, 3); 4114 __ CallExternalReference(miss, 3);
4118 // Compute the entry point of the rewritten stub. 4115 // Compute the entry point of the rewritten stub.
4119 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); 4116 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
4120 // Restore registers. 4117 // Restore registers.
(...skipping 11 matching lines...) Expand all
4132 __ str(lr, MemOperand(sp, 0)); 4129 __ str(lr, MemOperand(sp, 0));
4133 __ blx(ip); // Call the C++ function. 4130 __ blx(ip); // Call the C++ function.
4134 __ VFPEnsureFPSCRState(r2); 4131 __ VFPEnsureFPSCRState(r2);
4135 __ ldr(pc, MemOperand(sp, 0)); 4132 __ ldr(pc, MemOperand(sp, 0));
4136 } 4133 }
4137 4134
4138 4135
4139 void DirectCEntryStub::GenerateCall(MacroAssembler* masm, 4136 void DirectCEntryStub::GenerateCall(MacroAssembler* masm,
4140 Register target) { 4137 Register target) {
4141 intptr_t code = 4138 intptr_t code =
4142 reinterpret_cast<intptr_t>(GetCode(masm->isolate()).location()); 4139 reinterpret_cast<intptr_t>(GetCode(isolate()).location());
4143 __ Move(ip, target); 4140 __ Move(ip, target);
4144 __ mov(lr, Operand(code, RelocInfo::CODE_TARGET)); 4141 __ mov(lr, Operand(code, RelocInfo::CODE_TARGET));
4145 __ blx(lr); // Call the stub. 4142 __ blx(lr); // Call the stub.
4146 } 4143 }
4147 4144
4148 4145
4149 void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm, 4146 void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
4150 Label* miss, 4147 Label* miss,
4151 Label* done, 4148 Label* done,
4152 Register receiver, 4149 Register receiver,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4208 FieldMemOperand(receiver, JSObject::kPropertiesOffset)); 4205 FieldMemOperand(receiver, JSObject::kPropertiesOffset));
4209 } 4206 }
4210 4207
4211 const int spill_mask = 4208 const int spill_mask =
4212 (lr.bit() | r6.bit() | r5.bit() | r4.bit() | r3.bit() | 4209 (lr.bit() | r6.bit() | r5.bit() | r4.bit() | r3.bit() |
4213 r2.bit() | r1.bit() | r0.bit()); 4210 r2.bit() | r1.bit() | r0.bit());
4214 4211
4215 __ stm(db_w, sp, spill_mask); 4212 __ stm(db_w, sp, spill_mask);
4216 __ ldr(r0, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); 4213 __ ldr(r0, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
4217 __ mov(r1, Operand(Handle<Name>(name))); 4214 __ mov(r1, Operand(Handle<Name>(name)));
4218 NameDictionaryLookupStub stub(NEGATIVE_LOOKUP); 4215 NameDictionaryLookupStub stub(masm->isolate(), NEGATIVE_LOOKUP);
4219 __ CallStub(&stub); 4216 __ CallStub(&stub);
4220 __ cmp(r0, Operand::Zero()); 4217 __ cmp(r0, Operand::Zero());
4221 __ ldm(ia_w, sp, spill_mask); 4218 __ ldm(ia_w, sp, spill_mask);
4222 4219
4223 __ b(eq, done); 4220 __ b(eq, done);
4224 __ b(ne, miss); 4221 __ b(ne, miss);
4225 } 4222 }
4226 4223
4227 4224
4228 // Probe the name dictionary in the |elements| register. Jump to the 4225 // Probe the name dictionary in the |elements| register. Jump to the
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4284 4281
4285 __ stm(db_w, sp, spill_mask); 4282 __ stm(db_w, sp, spill_mask);
4286 if (name.is(r0)) { 4283 if (name.is(r0)) {
4287 ASSERT(!elements.is(r1)); 4284 ASSERT(!elements.is(r1));
4288 __ Move(r1, name); 4285 __ Move(r1, name);
4289 __ Move(r0, elements); 4286 __ Move(r0, elements);
4290 } else { 4287 } else {
4291 __ Move(r0, elements); 4288 __ Move(r0, elements);
4292 __ Move(r1, name); 4289 __ Move(r1, name);
4293 } 4290 }
4294 NameDictionaryLookupStub stub(POSITIVE_LOOKUP); 4291 NameDictionaryLookupStub stub(masm->isolate(), POSITIVE_LOOKUP);
4295 __ CallStub(&stub); 4292 __ CallStub(&stub);
4296 __ cmp(r0, Operand::Zero()); 4293 __ cmp(r0, Operand::Zero());
4297 __ mov(scratch2, Operand(r2)); 4294 __ mov(scratch2, Operand(r2));
4298 __ ldm(ia_w, sp, spill_mask); 4295 __ ldm(ia_w, sp, spill_mask);
4299 4296
4300 __ b(ne, done); 4297 __ b(ne, done);
4301 __ b(eq, miss); 4298 __ b(eq, miss);
4302 } 4299 }
4303 4300
4304 4301
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
4388 __ Ret(); 4385 __ Ret();
4389 4386
4390 __ bind(&not_in_dictionary); 4387 __ bind(&not_in_dictionary);
4391 __ mov(result, Operand::Zero()); 4388 __ mov(result, Operand::Zero());
4392 __ Ret(); 4389 __ Ret();
4393 } 4390 }
4394 4391
4395 4392
4396 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime( 4393 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(
4397 Isolate* isolate) { 4394 Isolate* isolate) {
4398 StoreBufferOverflowStub stub1(kDontSaveFPRegs); 4395 StoreBufferOverflowStub stub1(isolate, kDontSaveFPRegs);
4399 stub1.GetCode(isolate); 4396 stub1.GetCode(isolate);
4400 // Hydrogen code stubs need stub2 at snapshot time. 4397 // Hydrogen code stubs need stub2 at snapshot time.
4401 StoreBufferOverflowStub stub2(kSaveFPRegs); 4398 StoreBufferOverflowStub stub2(isolate, kSaveFPRegs);
4402 stub2.GetCode(isolate); 4399 stub2.GetCode(isolate);
4403 } 4400 }
4404 4401
4405 4402
4406 bool CodeStub::CanUseFPRegisters() { 4403 bool CodeStub::CanUseFPRegisters() {
4407 return true; // VFP2 is a base requirement for V8 4404 return true; // VFP2 is a base requirement for V8
4408 } 4405 }
4409 4406
4410 4407
4411 // Takes the input in 3 registers: address_ value_ and object_. A pointer to 4408 // Takes the input in 3 registers: address_ value_ and object_. A pointer to
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
4497 regs_.SaveCallerSaveRegisters(masm, save_fp_regs_mode_); 4494 regs_.SaveCallerSaveRegisters(masm, save_fp_regs_mode_);
4498 int argument_count = 3; 4495 int argument_count = 3;
4499 __ PrepareCallCFunction(argument_count, regs_.scratch0()); 4496 __ PrepareCallCFunction(argument_count, regs_.scratch0());
4500 Register address = 4497 Register address =
4501 r0.is(regs_.address()) ? regs_.scratch0() : regs_.address(); 4498 r0.is(regs_.address()) ? regs_.scratch0() : regs_.address();
4502 ASSERT(!address.is(regs_.object())); 4499 ASSERT(!address.is(regs_.object()));
4503 ASSERT(!address.is(r0)); 4500 ASSERT(!address.is(r0));
4504 __ Move(address, regs_.address()); 4501 __ Move(address, regs_.address());
4505 __ Move(r0, regs_.object()); 4502 __ Move(r0, regs_.object());
4506 __ Move(r1, address); 4503 __ Move(r1, address);
4507 __ mov(r2, Operand(ExternalReference::isolate_address(masm->isolate()))); 4504 __ mov(r2, Operand(ExternalReference::isolate_address(isolate())));
4508 4505
4509 AllowExternalCallThatCantCauseGC scope(masm); 4506 AllowExternalCallThatCantCauseGC scope(masm);
4510 __ CallCFunction( 4507 __ CallCFunction(
4511 ExternalReference::incremental_marking_record_write_function( 4508 ExternalReference::incremental_marking_record_write_function(isolate()),
4512 masm->isolate()),
4513 argument_count); 4509 argument_count);
4514 regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode_); 4510 regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode_);
4515 } 4511 }
4516 4512
4517 4513
4518 void RecordWriteStub::CheckNeedsToInformIncrementalMarker( 4514 void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
4519 MacroAssembler* masm, 4515 MacroAssembler* masm,
4520 OnNoNeedToInformIncrementalMarker on_no_need, 4516 OnNoNeedToInformIncrementalMarker on_no_need,
4521 Mode mode) { 4517 Mode mode) {
4522 Label on_black; 4518 Label on_black;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
4657 4653
4658 // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. 4654 // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS.
4659 __ bind(&double_elements); 4655 __ bind(&double_elements);
4660 __ ldr(r5, FieldMemOperand(r1, JSObject::kElementsOffset)); 4656 __ ldr(r5, FieldMemOperand(r1, JSObject::kElementsOffset));
4661 __ StoreNumberToDoubleElements(r0, r3, r5, r6, d0, &slow_elements); 4657 __ StoreNumberToDoubleElements(r0, r3, r5, r6, d0, &slow_elements);
4662 __ Ret(); 4658 __ Ret();
4663 } 4659 }
4664 4660
4665 4661
4666 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { 4662 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) {
4667 CEntryStub ces(1, fp_registers_ ? kSaveFPRegs : kDontSaveFPRegs); 4663 CEntryStub ces(isolate(), 1, fp_registers_ ? kSaveFPRegs : kDontSaveFPRegs);
4668 __ Call(ces.GetCode(masm->isolate()), RelocInfo::CODE_TARGET); 4664 __ Call(ces.GetCode(isolate()), RelocInfo::CODE_TARGET);
4669 int parameter_count_offset = 4665 int parameter_count_offset =
4670 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; 4666 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset;
4671 __ ldr(r1, MemOperand(fp, parameter_count_offset)); 4667 __ ldr(r1, MemOperand(fp, parameter_count_offset));
4672 if (function_mode_ == JS_FUNCTION_STUB_MODE) { 4668 if (function_mode_ == JS_FUNCTION_STUB_MODE) {
4673 __ add(r1, r1, Operand(1)); 4669 __ add(r1, r1, Operand(1));
4674 } 4670 }
4675 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); 4671 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
4676 __ mov(r1, Operand(r1, LSL, kPointerSizeLog2)); 4672 __ mov(r1, Operand(r1, LSL, kPointerSizeLog2));
4677 __ add(sp, sp, r1); 4673 __ add(sp, sp, r1);
4678 __ Ret(); 4674 __ Ret();
4679 } 4675 }
4680 4676
4681 4677
4682 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { 4678 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
4683 if (masm->isolate()->function_entry_hook() != NULL) { 4679 if (masm->isolate()->function_entry_hook() != NULL) {
4684 ProfileEntryHookStub stub; 4680 ProfileEntryHookStub stub(masm->isolate());
4685 int code_size = masm->CallStubSize(&stub) + 2 * Assembler::kInstrSize; 4681 int code_size = masm->CallStubSize(&stub) + 2 * Assembler::kInstrSize;
4686 PredictableCodeSizeScope predictable(masm, code_size); 4682 PredictableCodeSizeScope predictable(masm, code_size);
4687 __ push(lr); 4683 __ push(lr);
4688 __ CallStub(&stub); 4684 __ CallStub(&stub);
4689 __ pop(lr); 4685 __ pop(lr);
4690 } 4686 }
4691 } 4687 }
4692 4688
4693 4689
4694 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { 4690 void ProfileEntryHookStub::Generate(MacroAssembler* masm) {
(...skipping 27 matching lines...) Expand all
4722 // Align the stack if necessary. 4718 // Align the stack if necessary.
4723 int frame_alignment = masm->ActivationFrameAlignment(); 4719 int frame_alignment = masm->ActivationFrameAlignment();
4724 if (frame_alignment > kPointerSize) { 4720 if (frame_alignment > kPointerSize) {
4725 __ mov(r5, sp); 4721 __ mov(r5, sp);
4726 ASSERT(IsPowerOf2(frame_alignment)); 4722 ASSERT(IsPowerOf2(frame_alignment));
4727 __ and_(sp, sp, Operand(-frame_alignment)); 4723 __ and_(sp, sp, Operand(-frame_alignment));
4728 } 4724 }
4729 4725
4730 #if V8_HOST_ARCH_ARM 4726 #if V8_HOST_ARCH_ARM
4731 int32_t entry_hook = 4727 int32_t entry_hook =
4732 reinterpret_cast<int32_t>(masm->isolate()->function_entry_hook()); 4728 reinterpret_cast<int32_t>(isolate()->function_entry_hook());
4733 __ mov(ip, Operand(entry_hook)); 4729 __ mov(ip, Operand(entry_hook));
4734 #else 4730 #else
4735 // Under the simulator we need to indirect the entry hook through a 4731 // Under the simulator we need to indirect the entry hook through a
4736 // trampoline function at a known address. 4732 // trampoline function at a known address.
4737 // It additionally takes an isolate as a third parameter 4733 // It additionally takes an isolate as a third parameter
4738 __ mov(r2, Operand(ExternalReference::isolate_address(masm->isolate()))); 4734 __ mov(r2, Operand(ExternalReference::isolate_address(isolate())));
4739 4735
4740 ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline)); 4736 ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline));
4741 __ mov(ip, Operand(ExternalReference(&dispatcher, 4737 __ mov(ip, Operand(ExternalReference(&dispatcher,
4742 ExternalReference::BUILTIN_CALL, 4738 ExternalReference::BUILTIN_CALL,
4743 masm->isolate()))); 4739 isolate())));
4744 #endif 4740 #endif
4745 __ Call(ip); 4741 __ Call(ip);
4746 4742
4747 // Restore the stack pointer if needed. 4743 // Restore the stack pointer if needed.
4748 if (frame_alignment > kPointerSize) { 4744 if (frame_alignment > kPointerSize) {
4749 __ mov(sp, r5); 4745 __ mov(sp, r5);
4750 } 4746 }
4751 4747
4752 // Also pop pc to get Ret(0). 4748 // Also pop pc to get Ret(0).
4753 __ ldm(ia_w, sp, kSavedRegs | pc.bit()); 4749 __ ldm(ia_w, sp, kSavedRegs | pc.bit());
4754 } 4750 }
4755 4751
4756 4752
4757 template<class T> 4753 template<class T>
4758 static void CreateArrayDispatch(MacroAssembler* masm, 4754 static void CreateArrayDispatch(MacroAssembler* masm,
4759 AllocationSiteOverrideMode mode) { 4755 AllocationSiteOverrideMode mode) {
4760 if (mode == DISABLE_ALLOCATION_SITES) { 4756 if (mode == DISABLE_ALLOCATION_SITES) {
4761 T stub(GetInitialFastElementsKind(), mode); 4757 T stub(masm->isolate(), GetInitialFastElementsKind(), mode);
4762 __ TailCallStub(&stub); 4758 __ TailCallStub(&stub);
4763 } else if (mode == DONT_OVERRIDE) { 4759 } else if (mode == DONT_OVERRIDE) {
4764 int last_index = GetSequenceIndexFromFastElementsKind( 4760 int last_index = GetSequenceIndexFromFastElementsKind(
4765 TERMINAL_FAST_ELEMENTS_KIND); 4761 TERMINAL_FAST_ELEMENTS_KIND);
4766 for (int i = 0; i <= last_index; ++i) { 4762 for (int i = 0; i <= last_index; ++i) {
4767 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 4763 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
4768 __ cmp(r3, Operand(kind)); 4764 __ cmp(r3, Operand(kind));
4769 T stub(kind); 4765 T stub(masm->isolate(), kind);
4770 __ TailCallStub(&stub, eq); 4766 __ TailCallStub(&stub, eq);
4771 } 4767 }
4772 4768
4773 // If we reached this point there is a problem. 4769 // If we reached this point there is a problem.
4774 __ Abort(kUnexpectedElementsKindInArrayConstructor); 4770 __ Abort(kUnexpectedElementsKindInArrayConstructor);
4775 } else { 4771 } else {
4776 UNREACHABLE(); 4772 UNREACHABLE();
4777 } 4773 }
4778 } 4774 }
4779 4775
(...skipping 21 matching lines...) Expand all
4801 4797
4802 // look at the first argument 4798 // look at the first argument
4803 __ ldr(r5, MemOperand(sp, 0)); 4799 __ ldr(r5, MemOperand(sp, 0));
4804 __ cmp(r5, Operand::Zero()); 4800 __ cmp(r5, Operand::Zero());
4805 __ b(eq, &normal_sequence); 4801 __ b(eq, &normal_sequence);
4806 4802
4807 if (mode == DISABLE_ALLOCATION_SITES) { 4803 if (mode == DISABLE_ALLOCATION_SITES) {
4808 ElementsKind initial = GetInitialFastElementsKind(); 4804 ElementsKind initial = GetInitialFastElementsKind();
4809 ElementsKind holey_initial = GetHoleyElementsKind(initial); 4805 ElementsKind holey_initial = GetHoleyElementsKind(initial);
4810 4806
4811 ArraySingleArgumentConstructorStub stub_holey(holey_initial, 4807 ArraySingleArgumentConstructorStub stub_holey(masm->isolate(),
4808 holey_initial,
4812 DISABLE_ALLOCATION_SITES); 4809 DISABLE_ALLOCATION_SITES);
4813 __ TailCallStub(&stub_holey); 4810 __ TailCallStub(&stub_holey);
4814 4811
4815 __ bind(&normal_sequence); 4812 __ bind(&normal_sequence);
4816 ArraySingleArgumentConstructorStub stub(initial, 4813 ArraySingleArgumentConstructorStub stub(masm->isolate(),
4814 initial,
4817 DISABLE_ALLOCATION_SITES); 4815 DISABLE_ALLOCATION_SITES);
4818 __ TailCallStub(&stub); 4816 __ TailCallStub(&stub);
4819 } else if (mode == DONT_OVERRIDE) { 4817 } else if (mode == DONT_OVERRIDE) {
4820 // We are going to create a holey array, but our kind is non-holey. 4818 // We are going to create a holey array, but our kind is non-holey.
4821 // Fix kind and retry (only if we have an allocation site in the slot). 4819 // Fix kind and retry (only if we have an allocation site in the slot).
4822 __ add(r3, r3, Operand(1)); 4820 __ add(r3, r3, Operand(1));
4823 4821
4824 if (FLAG_debug_code) { 4822 if (FLAG_debug_code) {
4825 __ ldr(r5, FieldMemOperand(r2, 0)); 4823 __ ldr(r5, FieldMemOperand(r2, 0));
4826 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); 4824 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex);
4827 __ Assert(eq, kExpectedAllocationSite); 4825 __ Assert(eq, kExpectedAllocationSite);
4828 } 4826 }
4829 4827
4830 // Save the resulting elements kind in type info. We can't just store r3 4828 // Save the resulting elements kind in type info. We can't just store r3
4831 // in the AllocationSite::transition_info field because elements kind is 4829 // in the AllocationSite::transition_info field because elements kind is
4832 // restricted to a portion of the field...upper bits need to be left alone. 4830 // restricted to a portion of the field...upper bits need to be left alone.
4833 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); 4831 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
4834 __ ldr(r4, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset)); 4832 __ ldr(r4, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset));
4835 __ add(r4, r4, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); 4833 __ add(r4, r4, Operand(Smi::FromInt(kFastElementsKindPackedToHoley)));
4836 __ str(r4, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset)); 4834 __ str(r4, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset));
4837 4835
4838 __ bind(&normal_sequence); 4836 __ bind(&normal_sequence);
4839 int last_index = GetSequenceIndexFromFastElementsKind( 4837 int last_index = GetSequenceIndexFromFastElementsKind(
4840 TERMINAL_FAST_ELEMENTS_KIND); 4838 TERMINAL_FAST_ELEMENTS_KIND);
4841 for (int i = 0; i <= last_index; ++i) { 4839 for (int i = 0; i <= last_index; ++i) {
4842 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 4840 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
4843 __ cmp(r3, Operand(kind)); 4841 __ cmp(r3, Operand(kind));
4844 ArraySingleArgumentConstructorStub stub(kind); 4842 ArraySingleArgumentConstructorStub stub(masm->isolate(), kind);
4845 __ TailCallStub(&stub, eq); 4843 __ TailCallStub(&stub, eq);
4846 } 4844 }
4847 4845
4848 // If we reached this point there is a problem. 4846 // If we reached this point there is a problem.
4849 __ Abort(kUnexpectedElementsKindInArrayConstructor); 4847 __ Abort(kUnexpectedElementsKindInArrayConstructor);
4850 } else { 4848 } else {
4851 UNREACHABLE(); 4849 UNREACHABLE();
4852 } 4850 }
4853 } 4851 }
4854 4852
4855 4853
4856 template<class T> 4854 template<class T>
4857 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { 4855 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
4858 int to_index = GetSequenceIndexFromFastElementsKind( 4856 int to_index = GetSequenceIndexFromFastElementsKind(
4859 TERMINAL_FAST_ELEMENTS_KIND); 4857 TERMINAL_FAST_ELEMENTS_KIND);
4860 for (int i = 0; i <= to_index; ++i) { 4858 for (int i = 0; i <= to_index; ++i) {
4861 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 4859 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
4862 T stub(kind); 4860 T stub(isolate, kind);
4863 stub.GetCode(isolate); 4861 stub.GetCode(isolate);
4864 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { 4862 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) {
4865 T stub1(kind, DISABLE_ALLOCATION_SITES); 4863 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES);
4866 stub1.GetCode(isolate); 4864 stub1.GetCode(isolate);
4867 } 4865 }
4868 } 4866 }
4869 } 4867 }
4870 4868
4871 4869
4872 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { 4870 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) {
4873 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( 4871 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>(
4874 isolate); 4872 isolate);
4875 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( 4873 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>(
4876 isolate); 4874 isolate);
4877 ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>( 4875 ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>(
4878 isolate); 4876 isolate);
4879 } 4877 }
4880 4878
4881 4879
4882 void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime( 4880 void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(
4883 Isolate* isolate) { 4881 Isolate* isolate) {
4884 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS }; 4882 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS };
4885 for (int i = 0; i < 2; i++) { 4883 for (int i = 0; i < 2; i++) {
4886 // For internal arrays we only need a few things 4884 // For internal arrays we only need a few things
4887 InternalArrayNoArgumentConstructorStub stubh1(kinds[i]); 4885 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
4888 stubh1.GetCode(isolate); 4886 stubh1.GetCode(isolate);
4889 InternalArraySingleArgumentConstructorStub stubh2(kinds[i]); 4887 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]);
4890 stubh2.GetCode(isolate); 4888 stubh2.GetCode(isolate);
4891 InternalArrayNArgumentsConstructorStub stubh3(kinds[i]); 4889 InternalArrayNArgumentsConstructorStub stubh3(isolate, kinds[i]);
4892 stubh3.GetCode(isolate); 4890 stubh3.GetCode(isolate);
4893 } 4891 }
4894 } 4892 }
4895 4893
4896 4894
4897 void ArrayConstructorStub::GenerateDispatchToArrayStub( 4895 void ArrayConstructorStub::GenerateDispatchToArrayStub(
4898 MacroAssembler* masm, 4896 MacroAssembler* masm,
4899 AllocationSiteOverrideMode mode) { 4897 AllocationSiteOverrideMode mode) {
4900 if (argument_count_ == ANY) { 4898 if (argument_count_ == ANY) {
4901 Label not_zero_case, not_one_case; 4899 Label not_zero_case, not_one_case;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
4960 4958
4961 __ bind(&no_info); 4959 __ bind(&no_info);
4962 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 4960 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
4963 } 4961 }
4964 4962
4965 4963
4966 void InternalArrayConstructorStub::GenerateCase( 4964 void InternalArrayConstructorStub::GenerateCase(
4967 MacroAssembler* masm, ElementsKind kind) { 4965 MacroAssembler* masm, ElementsKind kind) {
4968 __ cmp(r0, Operand(1)); 4966 __ cmp(r0, Operand(1));
4969 4967
4970 InternalArrayNoArgumentConstructorStub stub0(kind); 4968 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind);
4971 __ TailCallStub(&stub0, lo); 4969 __ TailCallStub(&stub0, lo);
4972 4970
4973 InternalArrayNArgumentsConstructorStub stubN(kind); 4971 InternalArrayNArgumentsConstructorStub stubN(isolate(), kind);
4974 __ TailCallStub(&stubN, hi); 4972 __ TailCallStub(&stubN, hi);
4975 4973
4976 if (IsFastPackedElementsKind(kind)) { 4974 if (IsFastPackedElementsKind(kind)) {
4977 // We might need to create a holey array 4975 // We might need to create a holey array
4978 // look at the first argument 4976 // look at the first argument
4979 __ ldr(r3, MemOperand(sp, 0)); 4977 __ ldr(r3, MemOperand(sp, 0));
4980 __ cmp(r3, Operand::Zero()); 4978 __ cmp(r3, Operand::Zero());
4981 4979
4982 InternalArraySingleArgumentConstructorStub 4980 InternalArraySingleArgumentConstructorStub
4983 stub1_holey(GetHoleyElementsKind(kind)); 4981 stub1_holey(isolate(), GetHoleyElementsKind(kind));
4984 __ TailCallStub(&stub1_holey, ne); 4982 __ TailCallStub(&stub1_holey, ne);
4985 } 4983 }
4986 4984
4987 InternalArraySingleArgumentConstructorStub stub1(kind); 4985 InternalArraySingleArgumentConstructorStub stub1(isolate(), kind);
4988 __ TailCallStub(&stub1); 4986 __ TailCallStub(&stub1);
4989 } 4987 }
4990 4988
4991 4989
4992 void InternalArrayConstructorStub::Generate(MacroAssembler* masm) { 4990 void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
4993 // ----------- S t a t e ------------- 4991 // ----------- S t a t e -------------
4994 // -- r0 : argc 4992 // -- r0 : argc
4995 // -- r1 : constructor 4993 // -- r1 : constructor
4996 // -- sp[0] : return address 4994 // -- sp[0] : return address
4997 // -- sp[4] : last argument 4995 // -- sp[4] : last argument
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
5066 5064
5067 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 5065 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
5068 STATIC_ASSERT(FCA::kCalleeIndex == 5); 5066 STATIC_ASSERT(FCA::kCalleeIndex == 5);
5069 STATIC_ASSERT(FCA::kDataIndex == 4); 5067 STATIC_ASSERT(FCA::kDataIndex == 4);
5070 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 5068 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
5071 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 5069 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
5072 STATIC_ASSERT(FCA::kIsolateIndex == 1); 5070 STATIC_ASSERT(FCA::kIsolateIndex == 1);
5073 STATIC_ASSERT(FCA::kHolderIndex == 0); 5071 STATIC_ASSERT(FCA::kHolderIndex == 0);
5074 STATIC_ASSERT(FCA::kArgsLength == 7); 5072 STATIC_ASSERT(FCA::kArgsLength == 7);
5075 5073
5076 Isolate* isolate = masm->isolate();
5077
5078 // context save 5074 // context save
5079 __ push(context); 5075 __ push(context);
5080 // load context from callee 5076 // load context from callee
5081 __ ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset)); 5077 __ ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
5082 5078
5083 // callee 5079 // callee
5084 __ push(callee); 5080 __ push(callee);
5085 5081
5086 // call data 5082 // call data
5087 __ push(call_data); 5083 __ push(call_data);
5088 5084
5089 Register scratch = call_data; 5085 Register scratch = call_data;
5090 if (!call_data_undefined) { 5086 if (!call_data_undefined) {
5091 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 5087 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
5092 } 5088 }
5093 // return value 5089 // return value
5094 __ push(scratch); 5090 __ push(scratch);
5095 // return value default 5091 // return value default
5096 __ push(scratch); 5092 __ push(scratch);
5097 // isolate 5093 // isolate
5098 __ mov(scratch, 5094 __ mov(scratch,
5099 Operand(ExternalReference::isolate_address(isolate))); 5095 Operand(ExternalReference::isolate_address(isolate())));
5100 __ push(scratch); 5096 __ push(scratch);
5101 // holder 5097 // holder
5102 __ push(holder); 5098 __ push(holder);
5103 5099
5104 // Prepare arguments. 5100 // Prepare arguments.
5105 __ mov(scratch, sp); 5101 __ mov(scratch, sp);
5106 5102
5107 // Allocate the v8::Arguments structure in the arguments' space since 5103 // Allocate the v8::Arguments structure in the arguments' space since
5108 // it's not controlled by GC. 5104 // it's not controlled by GC.
5109 const int kApiStackSpace = 4; 5105 const int kApiStackSpace = 4;
(...skipping 15 matching lines...) Expand all
5125 __ str(ip, MemOperand(r0, 2 * kPointerSize)); 5121 __ str(ip, MemOperand(r0, 2 * kPointerSize));
5126 // FunctionCallbackInfo::is_construct_call = 0 5122 // FunctionCallbackInfo::is_construct_call = 0
5127 __ mov(ip, Operand::Zero()); 5123 __ mov(ip, Operand::Zero());
5128 __ str(ip, MemOperand(r0, 3 * kPointerSize)); 5124 __ str(ip, MemOperand(r0, 3 * kPointerSize));
5129 5125
5130 const int kStackUnwindSpace = argc + FCA::kArgsLength + 1; 5126 const int kStackUnwindSpace = argc + FCA::kArgsLength + 1;
5131 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); 5127 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback);
5132 ExternalReference::Type thunk_type = ExternalReference::PROFILING_API_CALL; 5128 ExternalReference::Type thunk_type = ExternalReference::PROFILING_API_CALL;
5133 ApiFunction thunk_fun(thunk_address); 5129 ApiFunction thunk_fun(thunk_address);
5134 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, 5130 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
5135 masm->isolate()); 5131 isolate());
5136 5132
5137 AllowExternalCallThatCantCauseGC scope(masm); 5133 AllowExternalCallThatCantCauseGC scope(masm);
5138 MemOperand context_restore_operand( 5134 MemOperand context_restore_operand(
5139 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 5135 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
5140 // Stores return the first js argument 5136 // Stores return the first js argument
5141 int return_value_offset = 0; 5137 int return_value_offset = 0;
5142 if (is_store) { 5138 if (is_store) {
5143 return_value_offset = 2 + FCA::kArgsLength; 5139 return_value_offset = 2 + FCA::kArgsLength;
5144 } else { 5140 } else {
5145 return_value_offset = 2 + FCA::kReturnValueOffset; 5141 return_value_offset = 2 + FCA::kReturnValueOffset;
(...skipping 30 matching lines...) Expand all
5176 __ str(r1, MemOperand(sp, 1 * kPointerSize)); 5172 __ str(r1, MemOperand(sp, 1 * kPointerSize));
5177 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo& 5173 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo&
5178 5174
5179 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; 5175 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
5180 5176
5181 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); 5177 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback);
5182 ExternalReference::Type thunk_type = 5178 ExternalReference::Type thunk_type =
5183 ExternalReference::PROFILING_GETTER_CALL; 5179 ExternalReference::PROFILING_GETTER_CALL;
5184 ApiFunction thunk_fun(thunk_address); 5180 ApiFunction thunk_fun(thunk_address);
5185 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, 5181 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
5186 masm->isolate()); 5182 isolate());
5187 __ CallApiFunctionAndReturn(api_function_address, 5183 __ CallApiFunctionAndReturn(api_function_address,
5188 thunk_ref, 5184 thunk_ref,
5189 kStackUnwindSpace, 5185 kStackUnwindSpace,
5190 MemOperand(fp, 6 * kPointerSize), 5186 MemOperand(fp, 6 * kPointerSize),
5191 NULL); 5187 NULL);
5192 } 5188 }
5193 5189
5194 5190
5195 #undef __ 5191 #undef __
5196 5192
5197 } } // namespace v8::internal 5193 } } // namespace v8::internal
5198 5194
5199 #endif // V8_TARGET_ARCH_ARM 5195 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/arm/debug-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698