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

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

Issue 7039036: Fix calls of strict mode function with an implicit receiver. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments. Created 9 years, 7 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/macro-assembler-arm.cc ('k') | src/ast.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 __ cmp(r4, r3); 1450 __ cmp(r4, r3);
1451 __ b(ne, miss); 1451 __ b(ne, miss);
1452 } else { 1452 } else {
1453 __ cmp(r1, Operand(Handle<JSFunction>(function))); 1453 __ cmp(r1, Operand(Handle<JSFunction>(function)));
1454 __ b(ne, miss); 1454 __ b(ne, miss);
1455 } 1455 }
1456 } 1456 }
1457 1457
1458 1458
1459 MaybeObject* CallStubCompiler::GenerateMissBranch() { 1459 MaybeObject* CallStubCompiler::GenerateMissBranch() {
1460 MaybeObject* maybe_obj = masm()->isolate()->stub_cache()->ComputeCallMiss( 1460 MaybeObject* maybe_obj =
1461 arguments().immediate(), kind_); 1461 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(),
1462 kind_,
1463 extra_ic_state_);
1462 Object* obj; 1464 Object* obj;
1463 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 1465 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1464 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); 1466 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET);
1465 return obj; 1467 return obj;
1466 } 1468 }
1467 1469
1468 1470
1469 MaybeObject* CallStubCompiler::CompileCallField(JSObject* object, 1471 MaybeObject* CallStubCompiler::CompileCallField(JSObject* object,
1470 JSObject* holder, 1472 JSObject* holder,
1471 int index, 1473 int index,
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 // If object is not a string, bail out to regular call. 1773 // If object is not a string, bail out to regular call.
1772 if (!object->IsString() || cell != NULL) return heap()->undefined_value(); 1774 if (!object->IsString() || cell != NULL) return heap()->undefined_value();
1773 1775
1774 const int argc = arguments().immediate(); 1776 const int argc = arguments().immediate();
1775 1777
1776 Label miss; 1778 Label miss;
1777 Label name_miss; 1779 Label name_miss;
1778 Label index_out_of_range; 1780 Label index_out_of_range;
1779 Label* index_out_of_range_label = &index_out_of_range; 1781 Label* index_out_of_range_label = &index_out_of_range;
1780 1782
1781 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { 1783 if (kind_ == Code::CALL_IC &&
1784 (CallICBase::StringStubState::decode(extra_ic_state_) ==
1785 DEFAULT_STRING_STUB)) {
1782 index_out_of_range_label = &miss; 1786 index_out_of_range_label = &miss;
1783 } 1787 }
1784 1788
1785 GenerateNameCheck(name, &name_miss); 1789 GenerateNameCheck(name, &name_miss);
1786 1790
1787 // Check that the maps starting from the prototype haven't changed. 1791 // Check that the maps starting from the prototype haven't changed.
1788 GenerateDirectLoadGlobalFunctionPrototype(masm(), 1792 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1789 Context::STRING_FUNCTION_INDEX, 1793 Context::STRING_FUNCTION_INDEX,
1790 r0, 1794 r0,
1791 &miss); 1795 &miss);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 // If object is not a string, bail out to regular call. 1859 // If object is not a string, bail out to regular call.
1856 if (!object->IsString() || cell != NULL) return heap()->undefined_value(); 1860 if (!object->IsString() || cell != NULL) return heap()->undefined_value();
1857 1861
1858 const int argc = arguments().immediate(); 1862 const int argc = arguments().immediate();
1859 1863
1860 Label miss; 1864 Label miss;
1861 Label name_miss; 1865 Label name_miss;
1862 Label index_out_of_range; 1866 Label index_out_of_range;
1863 Label* index_out_of_range_label = &index_out_of_range; 1867 Label* index_out_of_range_label = &index_out_of_range;
1864 1868
1865 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { 1869 if (kind_ == Code::CALL_IC &&
1870 (CallICBase::StringStubState::decode(extra_ic_state_) ==
1871 DEFAULT_STRING_STUB)) {
1866 index_out_of_range_label = &miss; 1872 index_out_of_range_label = &miss;
1867 } 1873 }
1868 1874
1869 GenerateNameCheck(name, &name_miss); 1875 GenerateNameCheck(name, &name_miss);
1870 1876
1871 // Check that the maps starting from the prototype haven't changed. 1877 // Check that the maps starting from the prototype haven't changed.
1872 GenerateDirectLoadGlobalFunctionPrototype(masm(), 1878 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1873 Context::STRING_FUNCTION_INDEX, 1879 Context::STRING_FUNCTION_INDEX,
1874 r0, 1880 r0,
1875 &miss); 1881 &miss);
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
2482 // Handle call cache miss. 2488 // Handle call cache miss.
2483 __ bind(&miss); 2489 __ bind(&miss);
2484 MaybeObject* maybe_result = GenerateMissBranch(); 2490 MaybeObject* maybe_result = GenerateMissBranch();
2485 if (maybe_result->IsFailure()) return maybe_result; 2491 if (maybe_result->IsFailure()) return maybe_result;
2486 2492
2487 // Return the generated code. 2493 // Return the generated code.
2488 return GetCode(INTERCEPTOR, name); 2494 return GetCode(INTERCEPTOR, name);
2489 } 2495 }
2490 2496
2491 2497
2492 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, 2498 MaybeObject* CallStubCompiler::CompileCallGlobal(
2493 GlobalObject* holder, 2499 JSObject* object,
2494 JSGlobalPropertyCell* cell, 2500 GlobalObject* holder,
2495 JSFunction* function, 2501 JSGlobalPropertyCell* cell,
2496 String* name) { 2502 JSFunction* function,
2503 String* name,
2504 Code::ExtraICState extra_ic_state) {
2497 // ----------- S t a t e ------------- 2505 // ----------- S t a t e -------------
2498 // -- r2 : name 2506 // -- r2 : name
2499 // -- lr : return address 2507 // -- lr : return address
2500 // ----------------------------------- 2508 // -----------------------------------
2501 2509
2502 if (HasCustomCallGenerator(function)) { 2510 if (HasCustomCallGenerator(function)) {
2503 MaybeObject* maybe_result = CompileCustomCall( 2511 MaybeObject* maybe_result = CompileCustomCall(
2504 object, holder, cell, function, name); 2512 object, holder, cell, function, name);
2505 Object* result; 2513 Object* result;
2506 if (!maybe_result->ToObject(&result)) return maybe_result; 2514 if (!maybe_result->ToObject(&result)) return maybe_result;
(...skipping 21 matching lines...) Expand all
2528 2536
2529 // Setup the context (function already in r1). 2537 // Setup the context (function already in r1).
2530 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 2538 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
2531 2539
2532 // Jump to the cached code (tail call). 2540 // Jump to the cached code (tail call).
2533 Counters* counters = masm()->isolate()->counters(); 2541 Counters* counters = masm()->isolate()->counters();
2534 __ IncrementCounter(counters->call_global_inline(), 1, r3, r4); 2542 __ IncrementCounter(counters->call_global_inline(), 1, r3, r4);
2535 ASSERT(function->is_compiled()); 2543 ASSERT(function->is_compiled());
2536 Handle<Code> code(function->code()); 2544 Handle<Code> code(function->code());
2537 ParameterCount expected(function->shared()->formal_parameter_count()); 2545 ParameterCount expected(function->shared()->formal_parameter_count());
2546 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state)
2547 ? CALL_AS_FUNCTION
2548 : CALL_AS_METHOD;
2538 if (V8::UseCrankshaft()) { 2549 if (V8::UseCrankshaft()) {
2539 // TODO(kasperl): For now, we always call indirectly through the 2550 // TODO(kasperl): For now, we always call indirectly through the
2540 // code field in the function to allow recompilation to take effect 2551 // code field in the function to allow recompilation to take effect
2541 // without changing any of the call sites. 2552 // without changing any of the call sites.
2542 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); 2553 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
2543 __ InvokeCode(r3, expected, arguments(), JUMP_FUNCTION); 2554 __ InvokeCode(r3, expected, arguments(), JUMP_FUNCTION,
2555 NullCallWrapper(), call_kind);
2544 } else { 2556 } else {
2545 __ InvokeCode(code, expected, arguments(), 2557 __ InvokeCode(code, expected, arguments(), RelocInfo::CODE_TARGET,
2546 RelocInfo::CODE_TARGET, JUMP_FUNCTION); 2558 JUMP_FUNCTION, call_kind);
2547 } 2559 }
2548 2560
2549 // Handle call cache miss. 2561 // Handle call cache miss.
2550 __ bind(&miss); 2562 __ bind(&miss);
2551 __ IncrementCounter(counters->call_global_inline_miss(), 1, r1, r3); 2563 __ IncrementCounter(counters->call_global_inline_miss(), 1, r1, r3);
2552 MaybeObject* maybe_result = GenerateMissBranch(); 2564 MaybeObject* maybe_result = GenerateMissBranch();
2553 if (maybe_result->IsFailure()) return maybe_result; 2565 if (maybe_result->IsFailure()) return maybe_result;
2554 2566
2555 // Return the generated code. 2567 // Return the generated code.
2556 return GetCode(NORMAL, name); 2568 return GetCode(NORMAL, name);
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
4222 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); 4234 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
4223 __ Jump(ic, RelocInfo::CODE_TARGET); 4235 __ Jump(ic, RelocInfo::CODE_TARGET);
4224 } 4236 }
4225 4237
4226 4238
4227 #undef __ 4239 #undef __
4228 4240
4229 } } // namespace v8::internal 4241 } } // namespace v8::internal
4230 4242
4231 #endif // V8_TARGET_ARCH_ARM 4243 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698