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

Side by Side Diff: src/mips/stub-cache-mips.cc

Issue 110573004: Merge bleeding_edge 17696:18016. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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
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 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 // If we've skipped any global objects, it's not enough to verify that 1280 // If we've skipped any global objects, it's not enough to verify that
1281 // their maps haven't changed. We also need to check that the property 1281 // their maps haven't changed. We also need to check that the property
1282 // cell for the property is still empty. 1282 // cell for the property is still empty.
1283 GenerateCheckPropertyCells(masm(), object, holder, name, scratch1, miss); 1283 GenerateCheckPropertyCells(masm(), object, holder, name, scratch1, miss);
1284 1284
1285 // Return the register containing the holder. 1285 // Return the register containing the holder.
1286 return reg; 1286 return reg;
1287 } 1287 }
1288 1288
1289 1289
1290 void LoadStubCompiler::HandlerFrontendFooter(Handle<Name> name, 1290 void LoadStubCompiler::HandlerFrontendFooter(Handle<Name> name, Label* miss) {
1291 Label* success,
1292 Label* miss) {
1293 if (!miss->is_unused()) { 1291 if (!miss->is_unused()) {
1294 __ Branch(success); 1292 Label success;
1293 __ Branch(&success);
1295 __ bind(miss); 1294 __ bind(miss);
1296 TailCallBuiltin(masm(), MissBuiltin(kind())); 1295 TailCallBuiltin(masm(), MissBuiltin(kind()));
1296 __ bind(&success);
1297 } 1297 }
1298 } 1298 }
1299 1299
1300 1300
1301 void StoreStubCompiler::HandlerFrontendFooter(Handle<Name> name, 1301 void StoreStubCompiler::HandlerFrontendFooter(Handle<Name> name, Label* miss) {
1302 Label* success,
1303 Label* miss) {
1304 if (!miss->is_unused()) { 1302 if (!miss->is_unused()) {
1305 __ b(success); 1303 Label success;
1304 __ Branch(&success);
1306 GenerateRestoreName(masm(), miss, name); 1305 GenerateRestoreName(masm(), miss, name);
1307 TailCallBuiltin(masm(), MissBuiltin(kind())); 1306 TailCallBuiltin(masm(), MissBuiltin(kind()));
1307 __ bind(&success);
1308 } 1308 }
1309 } 1309 }
1310 1310
1311 1311
1312 Register LoadStubCompiler::CallbackHandlerFrontend( 1312 Register LoadStubCompiler::CallbackHandlerFrontend(
1313 Handle<JSObject> object, 1313 Handle<Object> object,
1314 Register object_reg, 1314 Register object_reg,
1315 Handle<JSObject> holder, 1315 Handle<JSObject> holder,
1316 Handle<Name> name, 1316 Handle<Name> name,
1317 Label* success,
1318 Handle<Object> callback) { 1317 Handle<Object> callback) {
1319 Label miss; 1318 Label miss;
1320 1319
1321 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); 1320 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss);
1322 1321
1323 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { 1322 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
1324 ASSERT(!reg.is(scratch2())); 1323 ASSERT(!reg.is(scratch2()));
1325 ASSERT(!reg.is(scratch3())); 1324 ASSERT(!reg.is(scratch3()));
1326 ASSERT(!reg.is(scratch4())); 1325 ASSERT(!reg.is(scratch4()));
1327 1326
(...skipping 15 matching lines...) Expand all
1343 // If probing finds an entry in the dictionary, scratch3 contains the 1342 // If probing finds an entry in the dictionary, scratch3 contains the
1344 // pointer into the dictionary. Check that the value is the callback. 1343 // pointer into the dictionary. Check that the value is the callback.
1345 Register pointer = scratch3(); 1344 Register pointer = scratch3();
1346 const int kElementsStartOffset = NameDictionary::kHeaderSize + 1345 const int kElementsStartOffset = NameDictionary::kHeaderSize +
1347 NameDictionary::kElementsStartIndex * kPointerSize; 1346 NameDictionary::kElementsStartIndex * kPointerSize;
1348 const int kValueOffset = kElementsStartOffset + kPointerSize; 1347 const int kValueOffset = kElementsStartOffset + kPointerSize;
1349 __ lw(scratch2(), FieldMemOperand(pointer, kValueOffset)); 1348 __ lw(scratch2(), FieldMemOperand(pointer, kValueOffset));
1350 __ Branch(&miss, ne, scratch2(), Operand(callback)); 1349 __ Branch(&miss, ne, scratch2(), Operand(callback));
1351 } 1350 }
1352 1351
1353 HandlerFrontendFooter(name, success, &miss); 1352 HandlerFrontendFooter(name, &miss);
1354 return reg; 1353 return reg;
1355 } 1354 }
1356 1355
1357 1356
1358 void LoadStubCompiler::GenerateLoadField(Register reg, 1357 void LoadStubCompiler::GenerateLoadField(Register reg,
1359 Handle<JSObject> holder, 1358 Handle<JSObject> holder,
1360 PropertyIndex field, 1359 PropertyIndex field,
1361 Representation representation) { 1360 Representation representation) {
1362 if (!reg.is(receiver())) __ mov(receiver(), reg); 1361 if (!reg.is(receiver())) __ mov(receiver(), reg);
1363 if (kind() == Code::LOAD_IC) { 1362 if (kind() == Code::LOAD_IC) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 thunk_ref, 1452 thunk_ref,
1454 a2, 1453 a2,
1455 kStackUnwindSpace, 1454 kStackUnwindSpace,
1456 MemOperand(fp, 6 * kPointerSize), 1455 MemOperand(fp, 6 * kPointerSize),
1457 NULL); 1456 NULL);
1458 } 1457 }
1459 1458
1460 1459
1461 void LoadStubCompiler::GenerateLoadInterceptor( 1460 void LoadStubCompiler::GenerateLoadInterceptor(
1462 Register holder_reg, 1461 Register holder_reg,
1463 Handle<JSObject> object, 1462 Handle<Object> object,
1464 Handle<JSObject> interceptor_holder, 1463 Handle<JSObject> interceptor_holder,
1465 LookupResult* lookup, 1464 LookupResult* lookup,
1466 Handle<Name> name) { 1465 Handle<Name> name) {
1467 ASSERT(interceptor_holder->HasNamedInterceptor()); 1466 ASSERT(interceptor_holder->HasNamedInterceptor());
1468 ASSERT(!interceptor_holder->GetNamedInterceptor()->getter()->IsUndefined()); 1467 ASSERT(!interceptor_holder->GetNamedInterceptor()->getter()->IsUndefined());
1469 1468
1470 // So far the most popular follow ups for interceptor loads are FIELD 1469 // So far the most popular follow ups for interceptor loads are FIELD
1471 // and CALLBACKS, so inline only them, other cases may be added 1470 // and CALLBACKS, so inline only them, other cases may be added
1472 // later. 1471 // later.
1473 bool compile_followup_inline = false; 1472 bool compile_followup_inline = false;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 GenerateFastPropertyLoad(masm(), a1, reg, index.is_inobject(holder), 1630 GenerateFastPropertyLoad(masm(), a1, reg, index.is_inobject(holder),
1632 index.translate(holder), Representation::Tagged()); 1631 index.translate(holder), Representation::Tagged());
1633 1632
1634 GenerateCallFunction(masm(), object, arguments(), &miss, extra_state_); 1633 GenerateCallFunction(masm(), object, arguments(), &miss, extra_state_);
1635 1634
1636 // Handle call cache miss. 1635 // Handle call cache miss.
1637 __ bind(&miss); 1636 __ bind(&miss);
1638 GenerateMissBranch(); 1637 GenerateMissBranch();
1639 1638
1640 // Return the generated code. 1639 // Return the generated code.
1641 return GetCode(Code::FIELD, name); 1640 return GetCode(Code::FAST, name);
1642 } 1641 }
1643 1642
1644 1643
1645 Handle<Code> CallStubCompiler::CompileArrayCodeCall( 1644 Handle<Code> CallStubCompiler::CompileArrayCodeCall(
1646 Handle<Object> object, 1645 Handle<Object> object,
1647 Handle<JSObject> holder, 1646 Handle<JSObject> holder,
1648 Handle<Cell> cell, 1647 Handle<Cell> cell,
1649 Handle<JSFunction> function, 1648 Handle<JSFunction> function,
1650 Handle<String> name, 1649 Handle<String> name,
1651 Code::StubType type) { 1650 Code::StubType type) {
(...skipping 14 matching lines...) Expand all
1666 CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, a3, a0, 1665 CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, a3, a0,
1667 t0, name, &miss); 1666 t0, name, &miss);
1668 } else { 1667 } else {
1669 ASSERT(cell->value() == *function); 1668 ASSERT(cell->value() == *function);
1670 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, 1669 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
1671 &miss); 1670 &miss);
1672 GenerateLoadFunctionFromCell(cell, function, &miss); 1671 GenerateLoadFunctionFromCell(cell, function, &miss);
1673 } 1672 }
1674 1673
1675 Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite(); 1674 Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite();
1676 site->set_transition_info(Smi::FromInt(GetInitialFastElementsKind())); 1675 site->SetElementsKind(GetInitialFastElementsKind());
1677 Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site); 1676 Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site);
1678 __ li(a0, Operand(argc)); 1677 __ li(a0, Operand(argc));
1679 __ li(a2, Operand(site_feedback_cell)); 1678 __ li(a2, Operand(site_feedback_cell));
1680 __ li(a1, Operand(function)); 1679 __ li(a1, Operand(function));
1681 1680
1682 ArrayConstructorStub stub(isolate()); 1681 ArrayConstructorStub stub(isolate());
1683 __ TailCallStub(&stub); 1682 __ TailCallStub(&stub);
1684 1683
1685 __ bind(&miss); 1684 __ bind(&miss);
1686 GenerateMissBranch(); 1685 GenerateMissBranch();
(...skipping 11 matching lines...) Expand all
1698 Handle<String> name, 1697 Handle<String> name,
1699 Code::StubType type) { 1698 Code::StubType type) {
1700 // ----------- S t a t e ------------- 1699 // ----------- S t a t e -------------
1701 // -- a2 : name 1700 // -- a2 : name
1702 // -- ra : return address 1701 // -- ra : return address
1703 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 1702 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
1704 // -- ... 1703 // -- ...
1705 // -- sp[argc * 4] : receiver 1704 // -- sp[argc * 4] : receiver
1706 // ----------------------------------- 1705 // -----------------------------------
1707 1706
1708 // If object is not an array, bail out to regular call. 1707 // If object is not an array or is observed, bail out to regular call.
1709 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); 1708 if (!object->IsJSArray() ||
1709 !cell.is_null() ||
1710 Handle<JSArray>::cast(object)->map()->is_observed()) {
1711 return Handle<Code>::null();
1712 }
1710 1713
1711 Label miss; 1714 Label miss;
1712 1715
1713 GenerateNameCheck(name, &miss); 1716 GenerateNameCheck(name, &miss);
1714 1717
1715 Register receiver = a1; 1718 Register receiver = a1;
1716 1719
1717 // Get the receiver from the stack. 1720 // Get the receiver from the stack.
1718 const int argc = arguments().immediate(); 1721 const int argc = arguments().immediate();
1719 __ lw(receiver, MemOperand(sp, argc * kPointerSize)); 1722 __ lw(receiver, MemOperand(sp, argc * kPointerSize));
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 Handle<String> name, 1956 Handle<String> name,
1954 Code::StubType type) { 1957 Code::StubType type) {
1955 // ----------- S t a t e ------------- 1958 // ----------- S t a t e -------------
1956 // -- a2 : name 1959 // -- a2 : name
1957 // -- ra : return address 1960 // -- ra : return address
1958 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) 1961 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based)
1959 // -- ... 1962 // -- ...
1960 // -- sp[argc * 4] : receiver 1963 // -- sp[argc * 4] : receiver
1961 // ----------------------------------- 1964 // -----------------------------------
1962 1965
1963 // If object is not an array, bail out to regular call. 1966 // If object is not an array or is observed, bail out to regular call.
1964 if (!object->IsJSArray() || !cell.is_null()) return Handle<Code>::null(); 1967 if (!object->IsJSArray() ||
1968 !cell.is_null() ||
1969 Handle<JSArray>::cast(object)->map()->is_observed()) {
1970 return Handle<Code>::null();
1971 }
1965 1972
1966 Label miss, return_undefined, call_builtin; 1973 Label miss, return_undefined, call_builtin;
1967 Register receiver = a1; 1974 Register receiver = a1;
1968 Register elements = a3; 1975 Register elements = a3;
1969 GenerateNameCheck(name, &miss); 1976 GenerateNameCheck(name, &miss);
1970 1977
1971 // Get the receiver from the stack. 1978 // Get the receiver from the stack.
1972 const int argc = arguments().immediate(); 1979 const int argc = arguments().immediate();
1973 __ lw(receiver, MemOperand(sp, argc * kPointerSize)); 1980 __ lw(receiver, MemOperand(sp, argc * kPointerSize));
1974 // Check that the receiver isn't a smi. 1981 // Check that the receiver isn't a smi.
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
2302 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, 2309 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
2303 &miss); 2310 &miss);
2304 GenerateLoadFunctionFromCell(cell, function, &miss); 2311 GenerateLoadFunctionFromCell(cell, function, &miss);
2305 } 2312 }
2306 2313
2307 // Load the (only) argument into v0. 2314 // Load the (only) argument into v0.
2308 __ lw(v0, MemOperand(sp, 0 * kPointerSize)); 2315 __ lw(v0, MemOperand(sp, 0 * kPointerSize));
2309 2316
2310 // If the argument is a smi, just return. 2317 // If the argument is a smi, just return.
2311 STATIC_ASSERT(kSmiTag == 0); 2318 STATIC_ASSERT(kSmiTag == 0);
2312 __ And(t0, v0, Operand(kSmiTagMask)); 2319 __ SmiTst(v0, t0);
2313 __ DropAndRet(argc + 1, eq, t0, Operand(zero_reg)); 2320 __ DropAndRet(argc + 1, eq, t0, Operand(zero_reg));
2314 2321
2315 __ CheckMap(v0, a1, Heap::kHeapNumberMapRootIndex, &slow, DONT_DO_SMI_CHECK); 2322 __ CheckMap(v0, a1, Heap::kHeapNumberMapRootIndex, &slow, DONT_DO_SMI_CHECK);
2316 2323
2317 Label wont_fit_smi, no_fpu_error, restore_fcsr_and_return; 2324 Label wont_fit_smi, no_fpu_error, restore_fcsr_and_return;
2318 2325
2319 // If fpu is enabled, we use the floor instruction. 2326 // If fpu is enabled, we use the floor instruction.
2320 2327
2321 // Load the HeapNumber value. 2328 // Load the HeapNumber value.
2322 __ ldc1(f0, FieldMemOperand(v0, HeapNumber::kValueOffset)); 2329 __ ldc1(f0, FieldMemOperand(v0, HeapNumber::kValueOffset));
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
2543 FreeSpaceForFastApiCall(masm()); 2550 FreeSpaceForFastApiCall(masm());
2544 2551
2545 __ bind(&miss_before_stack_reserved); 2552 __ bind(&miss_before_stack_reserved);
2546 GenerateMissBranch(); 2553 GenerateMissBranch();
2547 2554
2548 // Return the generated code. 2555 // Return the generated code.
2549 return GetCode(function); 2556 return GetCode(function);
2550 } 2557 }
2551 2558
2552 2559
2560 void StubCompiler::GenerateBooleanCheck(Register object, Label* miss) {
2561 Label success;
2562 // Check that the object is a boolean.
2563 __ LoadRoot(at, Heap::kTrueValueRootIndex);
2564 __ Branch(&success, eq, object, Operand(at));
2565 __ LoadRoot(at, Heap::kFalseValueRootIndex);
2566 __ Branch(miss, ne, object, Operand(at));
2567 __ bind(&success);
2568 }
2569
2570
2553 void CallStubCompiler::CompileHandlerFrontend(Handle<Object> object, 2571 void CallStubCompiler::CompileHandlerFrontend(Handle<Object> object,
2554 Handle<JSObject> holder, 2572 Handle<JSObject> holder,
2555 Handle<Name> name, 2573 Handle<Name> name,
2556 CheckType check, 2574 CheckType check) {
2557 Label* success) {
2558 // ----------- S t a t e ------------- 2575 // ----------- S t a t e -------------
2559 // -- a2 : name 2576 // -- a2 : name
2560 // -- ra : return address 2577 // -- ra : return address
2561 // ----------------------------------- 2578 // -----------------------------------
2562 Label miss; 2579 Label miss;
2563 GenerateNameCheck(name, &miss); 2580 GenerateNameCheck(name, &miss);
2564 2581
2565 // Get the receiver from the stack. 2582 // Get the receiver from the stack.
2566 const int argc = arguments().immediate(); 2583 const int argc = arguments().immediate();
2567 __ lw(a1, MemOperand(sp, argc * kPointerSize)); 2584 __ lw(a1, MemOperand(sp, argc * kPointerSize));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 __ bind(&fast); 2640 __ bind(&fast);
2624 // Check that the maps starting from the prototype haven't changed. 2641 // Check that the maps starting from the prototype haven't changed.
2625 GenerateDirectLoadGlobalFunctionPrototype( 2642 GenerateDirectLoadGlobalFunctionPrototype(
2626 masm(), Context::NUMBER_FUNCTION_INDEX, a0, &miss); 2643 masm(), Context::NUMBER_FUNCTION_INDEX, a0, &miss);
2627 CheckPrototypes( 2644 CheckPrototypes(
2628 Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))), 2645 Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
2629 a0, holder, a3, a1, t0, name, &miss); 2646 a0, holder, a3, a1, t0, name, &miss);
2630 break; 2647 break;
2631 } 2648 }
2632 case BOOLEAN_CHECK: { 2649 case BOOLEAN_CHECK: {
2633 Label fast; 2650 GenerateBooleanCheck(a1, &miss);
2634 // Check that the object is a boolean. 2651
2635 __ LoadRoot(t0, Heap::kTrueValueRootIndex);
2636 __ Branch(&fast, eq, a1, Operand(t0));
2637 __ LoadRoot(t0, Heap::kFalseValueRootIndex);
2638 __ Branch(&miss, ne, a1, Operand(t0));
2639 __ bind(&fast);
2640 // Check that the maps starting from the prototype haven't changed. 2652 // Check that the maps starting from the prototype haven't changed.
2641 GenerateDirectLoadGlobalFunctionPrototype( 2653 GenerateDirectLoadGlobalFunctionPrototype(
2642 masm(), Context::BOOLEAN_FUNCTION_INDEX, a0, &miss); 2654 masm(), Context::BOOLEAN_FUNCTION_INDEX, a0, &miss);
2643 CheckPrototypes( 2655 CheckPrototypes(
2644 Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))), 2656 Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
2645 a0, holder, a3, a1, t0, name, &miss); 2657 a0, holder, a3, a1, t0, name, &miss);
2646 break; 2658 break;
2647 } 2659 }
2648 } 2660 }
2649 2661
2650 __ jmp(success); 2662 Label success;
2663 __ Branch(&success);
2651 2664
2652 // Handle call cache miss. 2665 // Handle call cache miss.
2653 __ bind(&miss); 2666 __ bind(&miss);
2654 2667
2655 GenerateMissBranch(); 2668 GenerateMissBranch();
2669
2670 __ bind(&success);
2656 } 2671 }
2657 2672
2658 2673
2659 void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) { 2674 void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) {
2660 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) 2675 CallKind call_kind = CallICBase::Contextual::decode(extra_state_)
2661 ? CALL_AS_FUNCTION 2676 ? CALL_AS_FUNCTION
2662 : CALL_AS_METHOD; 2677 : CALL_AS_METHOD;
2663 ParameterCount expected(function); 2678 ParameterCount expected(function);
2664 __ InvokeFunction(function, expected, arguments(), 2679 __ InvokeFunction(function, expected, arguments(),
2665 JUMP_FUNCTION, NullCallWrapper(), call_kind); 2680 JUMP_FUNCTION, NullCallWrapper(), call_kind);
2666 } 2681 }
2667 2682
2668 2683
2669 Handle<Code> CallStubCompiler::CompileCallConstant( 2684 Handle<Code> CallStubCompiler::CompileCallConstant(
2670 Handle<Object> object, 2685 Handle<Object> object,
2671 Handle<JSObject> holder, 2686 Handle<JSObject> holder,
2672 Handle<Name> name, 2687 Handle<Name> name,
2673 CheckType check, 2688 CheckType check,
2674 Handle<JSFunction> function) { 2689 Handle<JSFunction> function) {
2675 if (HasCustomCallGenerator(function)) { 2690 if (HasCustomCallGenerator(function)) {
2676 Handle<Code> code = CompileCustomCall(object, holder, 2691 Handle<Code> code = CompileCustomCall(object, holder,
2677 Handle<Cell>::null(), 2692 Handle<Cell>::null(),
2678 function, Handle<String>::cast(name), 2693 function, Handle<String>::cast(name),
2679 Code::CONSTANT); 2694 Code::FAST);
2680 // A null handle means bail out to the regular compiler code below. 2695 // A null handle means bail out to the regular compiler code below.
2681 if (!code.is_null()) return code; 2696 if (!code.is_null()) return code;
2682 } 2697 }
2683 2698
2684 Label success; 2699 CompileHandlerFrontend(object, holder, name, check);
2685
2686 CompileHandlerFrontend(object, holder, name, check, &success);
2687 __ bind(&success);
2688 CompileHandlerBackend(function); 2700 CompileHandlerBackend(function);
2689 2701
2690 // Return the generated code. 2702 // Return the generated code.
2691 return GetCode(function); 2703 return GetCode(function);
2692 } 2704 }
2693 2705
2694 2706
2695 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, 2707 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object,
2696 Handle<JSObject> holder, 2708 Handle<JSObject> holder,
2697 Handle<Name> name) { 2709 Handle<Name> name) {
(...skipping 23 matching lines...) Expand all
2721 // Restore receiver. 2733 // Restore receiver.
2722 __ lw(a0, MemOperand(sp, argc * kPointerSize)); 2734 __ lw(a0, MemOperand(sp, argc * kPointerSize));
2723 2735
2724 GenerateCallFunction(masm(), object, arguments(), &miss, extra_state_); 2736 GenerateCallFunction(masm(), object, arguments(), &miss, extra_state_);
2725 2737
2726 // Handle call cache miss. 2738 // Handle call cache miss.
2727 __ bind(&miss); 2739 __ bind(&miss);
2728 GenerateMissBranch(); 2740 GenerateMissBranch();
2729 2741
2730 // Return the generated code. 2742 // Return the generated code.
2731 return GetCode(Code::INTERCEPTOR, name); 2743 return GetCode(Code::FAST, name);
2732 } 2744 }
2733 2745
2734 2746
2735 Handle<Code> CallStubCompiler::CompileCallGlobal( 2747 Handle<Code> CallStubCompiler::CompileCallGlobal(
2736 Handle<JSObject> object, 2748 Handle<JSObject> object,
2737 Handle<GlobalObject> holder, 2749 Handle<GlobalObject> holder,
2738 Handle<PropertyCell> cell, 2750 Handle<PropertyCell> cell,
2739 Handle<JSFunction> function, 2751 Handle<JSFunction> function,
2740 Handle<Name> name) { 2752 Handle<Name> name) {
2741 // ----------- S t a t e ------------- 2753 // ----------- S t a t e -------------
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2791 // Return the generated code. 2803 // Return the generated code.
2792 return GetCode(Code::NORMAL, name); 2804 return GetCode(Code::NORMAL, name);
2793 } 2805 }
2794 2806
2795 2807
2796 Handle<Code> StoreStubCompiler::CompileStoreCallback( 2808 Handle<Code> StoreStubCompiler::CompileStoreCallback(
2797 Handle<JSObject> object, 2809 Handle<JSObject> object,
2798 Handle<JSObject> holder, 2810 Handle<JSObject> holder,
2799 Handle<Name> name, 2811 Handle<Name> name,
2800 Handle<ExecutableAccessorInfo> callback) { 2812 Handle<ExecutableAccessorInfo> callback) {
2801 Label success; 2813 HandlerFrontend(object, receiver(), holder, name);
2802 HandlerFrontend(object, receiver(), holder, name, &success);
2803 __ bind(&success);
2804 2814
2805 // Stub never generated for non-global objects that require access 2815 // Stub never generated for non-global objects that require access
2806 // checks. 2816 // checks.
2807 ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded()); 2817 ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded());
2808 2818
2809 __ push(receiver()); // Receiver. 2819 __ push(receiver()); // Receiver.
2810 __ li(at, Operand(callback)); // Callback info. 2820 __ li(at, Operand(callback)); // Callback info.
2811 __ push(at); 2821 __ push(at);
2812 __ li(at, Operand(name)); 2822 __ li(at, Operand(name));
2813 __ Push(at, value()); 2823 __ Push(at, value());
2814 2824
2815 // Do tail-call to the runtime system. 2825 // Do tail-call to the runtime system.
2816 ExternalReference store_callback_property = 2826 ExternalReference store_callback_property =
2817 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); 2827 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
2818 __ TailCallExternalReference(store_callback_property, 4, 1); 2828 __ TailCallExternalReference(store_callback_property, 4, 1);
2819 2829
2820 // Return the generated code. 2830 // Return the generated code.
2821 return GetCode(kind(), Code::CALLBACKS, name); 2831 return GetCode(kind(), Code::FAST, name);
2822 } 2832 }
2823 2833
2824 2834
2825 Handle<Code> StoreStubCompiler::CompileStoreCallback( 2835 Handle<Code> StoreStubCompiler::CompileStoreCallback(
2826 Handle<JSObject> object, 2836 Handle<JSObject> object,
2827 Handle<JSObject> holder, 2837 Handle<JSObject> holder,
2828 Handle<Name> name, 2838 Handle<Name> name,
2829 const CallOptimization& call_optimization) { 2839 const CallOptimization& call_optimization) {
2830 Label success; 2840 HandlerFrontend(object, receiver(), holder, name);
2831 HandlerFrontend(object, receiver(), holder, name, &success);
2832 __ bind(&success);
2833 2841
2834 Register values[] = { value() }; 2842 Register values[] = { value() };
2835 GenerateFastApiCall( 2843 GenerateFastApiCall(
2836 masm(), call_optimization, receiver(), scratch3(), 1, values); 2844 masm(), call_optimization, receiver(), scratch3(), 1, values);
2837 2845
2838 // Return the generated code. 2846 // Return the generated code.
2839 return GetCode(kind(), Code::CALLBACKS, name); 2847 return GetCode(kind(), Code::FAST, name);
2840 } 2848 }
2841 2849
2842 2850
2843 #undef __ 2851 #undef __
2844 #define __ ACCESS_MASM(masm) 2852 #define __ ACCESS_MASM(masm)
2845 2853
2846 2854
2847 void StoreStubCompiler::GenerateStoreViaSetter( 2855 void StoreStubCompiler::GenerateStoreViaSetter(
2848 MacroAssembler* masm, 2856 MacroAssembler* masm,
2849 Handle<JSFunction> setter) { 2857 Handle<JSFunction> setter) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2913 // Do tail-call to the runtime system. 2921 // Do tail-call to the runtime system.
2914 ExternalReference store_ic_property = 2922 ExternalReference store_ic_property =
2915 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); 2923 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate());
2916 __ TailCallExternalReference(store_ic_property, 4, 1); 2924 __ TailCallExternalReference(store_ic_property, 4, 1);
2917 2925
2918 // Handle store cache miss. 2926 // Handle store cache miss.
2919 __ bind(&miss); 2927 __ bind(&miss);
2920 TailCallBuiltin(masm(), MissBuiltin(kind())); 2928 TailCallBuiltin(masm(), MissBuiltin(kind()));
2921 2929
2922 // Return the generated code. 2930 // Return the generated code.
2923 return GetCode(kind(), Code::INTERCEPTOR, name); 2931 return GetCode(kind(), Code::FAST, name);
2924 } 2932 }
2925 2933
2926 2934
2927 Handle<Code> LoadStubCompiler::CompileLoadNonexistent( 2935 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
2928 Handle<JSObject> object, 2936 Handle<Object> object,
2929 Handle<JSObject> last, 2937 Handle<JSObject> last,
2930 Handle<Name> name, 2938 Handle<Name> name,
2931 Handle<JSGlobalObject> global) { 2939 Handle<JSGlobalObject> global) {
2932 Label success; 2940 NonexistentHandlerFrontend(object, last, name, global);
2933 2941
2934 NonexistentHandlerFrontend(object, last, name, &success, global);
2935
2936 __ bind(&success);
2937 // Return undefined if maps of the full prototype chain is still the same. 2942 // Return undefined if maps of the full prototype chain is still the same.
2938 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); 2943 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
2939 __ Ret(); 2944 __ Ret();
2940 2945
2941 // Return the generated code. 2946 // Return the generated code.
2942 return GetCode(kind(), Code::NONEXISTENT, name); 2947 return GetCode(kind(), Code::FAST, name);
2943 } 2948 }
2944 2949
2945 2950
2946 Register* LoadStubCompiler::registers() { 2951 Register* LoadStubCompiler::registers() {
2947 // receiver, name, scratch1, scratch2, scratch3, scratch4. 2952 // receiver, name, scratch1, scratch2, scratch3, scratch4.
2948 static Register registers[] = { a0, a2, a3, a1, t0, t1 }; 2953 static Register registers[] = { a0, a2, a3, a1, t0, t1 };
2949 return registers; 2954 return registers;
2950 } 2955 }
2951 2956
2952 2957
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 } 3023 }
3019 __ Ret(); 3024 __ Ret();
3020 } 3025 }
3021 3026
3022 3027
3023 #undef __ 3028 #undef __
3024 #define __ ACCESS_MASM(masm()) 3029 #define __ ACCESS_MASM(masm())
3025 3030
3026 3031
3027 Handle<Code> LoadStubCompiler::CompileLoadGlobal( 3032 Handle<Code> LoadStubCompiler::CompileLoadGlobal(
3028 Handle<JSObject> object, 3033 Handle<Object> object,
3029 Handle<GlobalObject> global, 3034 Handle<GlobalObject> global,
3030 Handle<PropertyCell> cell, 3035 Handle<PropertyCell> cell,
3031 Handle<Name> name, 3036 Handle<Name> name,
3032 bool is_dont_delete) { 3037 bool is_dont_delete) {
3033 Label success, miss; 3038 Label miss;
3034 3039
3035 HandlerFrontendHeader(object, receiver(), global, name, &miss); 3040 HandlerFrontendHeader(object, receiver(), global, name, &miss);
3036 3041
3037 // Get the value from the cell. 3042 // Get the value from the cell.
3038 __ li(a3, Operand(cell)); 3043 __ li(a3, Operand(cell));
3039 __ lw(t0, FieldMemOperand(a3, Cell::kValueOffset)); 3044 __ lw(t0, FieldMemOperand(a3, Cell::kValueOffset));
3040 3045
3041 // Check for deleted property if property can actually be deleted. 3046 // Check for deleted property if property can actually be deleted.
3042 if (!is_dont_delete) { 3047 if (!is_dont_delete) {
3043 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 3048 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3044 __ Branch(&miss, eq, t0, Operand(at)); 3049 __ Branch(&miss, eq, t0, Operand(at));
3045 } 3050 }
3046 3051
3047 HandlerFrontendFooter(name, &success, &miss); 3052 HandlerFrontendFooter(name, &miss);
3048 __ bind(&success);
3049 3053
3050 Counters* counters = isolate()->counters(); 3054 Counters* counters = isolate()->counters();
3051 __ IncrementCounter(counters->named_load_global_stub(), 1, a1, a3); 3055 __ IncrementCounter(counters->named_load_global_stub(), 1, a1, a3);
3052 __ Ret(USE_DELAY_SLOT); 3056 __ Ret(USE_DELAY_SLOT);
3053 __ mov(v0, t0); 3057 __ mov(v0, t0);
3054 3058
3055 // Return the generated code. 3059 // Return the generated code.
3056 return GetCode(kind(), Code::NORMAL, name); 3060 return GetCode(kind(), Code::NORMAL, name);
3057 } 3061 }
3058 3062
3059 3063
3060 Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC( 3064 Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC(
3061 MapHandleList* receiver_maps, 3065 TypeHandleList* types,
3062 CodeHandleList* handlers, 3066 CodeHandleList* handlers,
3063 Handle<Name> name, 3067 Handle<Name> name,
3064 Code::StubType type, 3068 Code::StubType type,
3065 IcCheckType check) { 3069 IcCheckType check) {
3066 Label miss; 3070 Label miss;
3067 3071
3068 if (check == PROPERTY) { 3072 if (check == PROPERTY) {
3069 GenerateNameCheck(name, this->name(), &miss); 3073 GenerateNameCheck(name, this->name(), &miss);
3070 } 3074 }
3071 3075
3072 __ JumpIfSmi(receiver(), &miss); 3076 Label number_case;
3077 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss;
3078 __ JumpIfSmi(receiver(), smi_target);
3079
3073 Register map_reg = scratch1(); 3080 Register map_reg = scratch1();
3074 3081
3075 int receiver_count = receiver_maps->length(); 3082 int receiver_count = types->length();
3076 int number_of_handled_maps = 0; 3083 int number_of_handled_maps = 0;
3077 __ lw(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); 3084 __ lw(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset));
3078 for (int current = 0; current < receiver_count; ++current) { 3085 for (int current = 0; current < receiver_count; ++current) {
3079 Handle<Map> map = receiver_maps->at(current); 3086 Handle<Type> type = types->at(current);
3087 Handle<Map> map = IC::TypeToMap(*type, isolate());
3080 if (!map->is_deprecated()) { 3088 if (!map->is_deprecated()) {
3081 number_of_handled_maps++; 3089 number_of_handled_maps++;
3090 if (type->Is(Type::Number())) {
3091 ASSERT(!number_case.is_unused());
3092 __ bind(&number_case);
3093 }
3082 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, 3094 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET,
3083 eq, map_reg, Operand(receiver_maps->at(current))); 3095 eq, map_reg, Operand(map));
3084 } 3096 }
3085 } 3097 }
3086 ASSERT(number_of_handled_maps != 0); 3098 ASSERT(number_of_handled_maps != 0);
3087 3099
3088 __ bind(&miss); 3100 __ bind(&miss);
3089 TailCallBuiltin(masm(), MissBuiltin(kind())); 3101 TailCallBuiltin(masm(), MissBuiltin(kind()));
3090 3102
3091 // Return the generated code. 3103 // Return the generated code.
3092 InlineCacheState state = 3104 InlineCacheState state =
3093 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; 3105 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3130 #define __ ACCESS_MASM(masm) 3142 #define __ ACCESS_MASM(masm)
3131 3143
3132 3144
3133 void KeyedLoadStubCompiler::GenerateLoadDictionaryElement( 3145 void KeyedLoadStubCompiler::GenerateLoadDictionaryElement(
3134 MacroAssembler* masm) { 3146 MacroAssembler* masm) {
3135 // ---------- S t a t e -------------- 3147 // ---------- S t a t e --------------
3136 // -- ra : return address 3148 // -- ra : return address
3137 // -- a0 : key 3149 // -- a0 : key
3138 // -- a1 : receiver 3150 // -- a1 : receiver
3139 // ----------------------------------- 3151 // -----------------------------------
3140 Label slow, miss_force_generic; 3152 Label slow, miss;
3141 3153
3142 Register key = a0; 3154 Register key = a0;
3143 Register receiver = a1; 3155 Register receiver = a1;
3144 3156
3145 __ JumpIfNotSmi(key, &miss_force_generic); 3157 __ JumpIfNotSmi(key, &miss);
3146 __ lw(t0, FieldMemOperand(receiver, JSObject::kElementsOffset)); 3158 __ lw(t0, FieldMemOperand(receiver, JSObject::kElementsOffset));
3147 __ sra(a2, a0, kSmiTagSize); 3159 __ sra(a2, a0, kSmiTagSize);
3148 __ LoadFromNumberDictionary(&slow, t0, a0, v0, a2, a3, t1); 3160 __ LoadFromNumberDictionary(&slow, t0, a0, v0, a2, a3, t1);
3149 __ Ret(); 3161 __ Ret();
3150 3162
3151 // Slow case, key and receiver still in a0 and a1. 3163 // Slow case, key and receiver still in a0 and a1.
3152 __ bind(&slow); 3164 __ bind(&slow);
3153 __ IncrementCounter( 3165 __ IncrementCounter(
3154 masm->isolate()->counters()->keyed_load_external_array_slow(), 3166 masm->isolate()->counters()->keyed_load_external_array_slow(),
3155 1, a2, a3); 3167 1, a2, a3);
3156 // Entry registers are intact. 3168 // Entry registers are intact.
3157 // ---------- S t a t e -------------- 3169 // ---------- S t a t e --------------
3158 // -- ra : return address 3170 // -- ra : return address
3159 // -- a0 : key 3171 // -- a0 : key
3160 // -- a1 : receiver 3172 // -- a1 : receiver
3161 // ----------------------------------- 3173 // -----------------------------------
3162 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Slow); 3174 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Slow);
3163 3175
3164 // Miss case, call the runtime. 3176 // Miss case, call the runtime.
3165 __ bind(&miss_force_generic); 3177 __ bind(&miss);
3166 3178
3167 // ---------- S t a t e -------------- 3179 // ---------- S t a t e --------------
3168 // -- ra : return address 3180 // -- ra : return address
3169 // -- a0 : key 3181 // -- a0 : key
3170 // -- a1 : receiver 3182 // -- a1 : receiver
3171 // ----------------------------------- 3183 // -----------------------------------
3172 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3184 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
3173 } 3185 }
3174 3186
3175 3187
3176 #undef __ 3188 #undef __
3177 3189
3178 } } // namespace v8::internal 3190 } } // namespace v8::internal
3179 3191
3180 #endif // V8_TARGET_ARCH_MIPS 3192 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« include/v8-platform.h ('K') | « src/mips/macro-assembler-mips.cc ('k') | src/mksnapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698