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

Side by Side Diff: src/ia32/stub-cache-ia32.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: Fix presubmit 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
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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 } else { 1315 } else {
1316 __ cmp(Operand(edi), Immediate(Handle<JSFunction>(function))); 1316 __ cmp(Operand(edi), Immediate(Handle<JSFunction>(function)));
1317 __ j(not_equal, miss); 1317 __ j(not_equal, miss);
1318 } 1318 }
1319 } 1319 }
1320 1320
1321 1321
1322 MaybeObject* CallStubCompiler::GenerateMissBranch() { 1322 MaybeObject* CallStubCompiler::GenerateMissBranch() {
1323 MaybeObject* maybe_obj = 1323 MaybeObject* maybe_obj =
1324 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(), 1324 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(),
1325 kind_); 1325 kind_,
1326 extra_ic_state_);
1326 Object* obj; 1327 Object* obj;
1327 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 1328 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1328 __ jmp(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); 1329 __ jmp(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET);
1329 return obj; 1330 return obj;
1330 } 1331 }
1331 1332
1332 1333
1333 MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField( 1334 MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField(
1334 JSObject* object, 1335 JSObject* object,
1335 JSObject* holder, 1336 JSObject* holder,
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 return isolate()->heap()->undefined_value(); 1643 return isolate()->heap()->undefined_value();
1643 } 1644 }
1644 1645
1645 const int argc = arguments().immediate(); 1646 const int argc = arguments().immediate();
1646 1647
1647 Label miss; 1648 Label miss;
1648 Label name_miss; 1649 Label name_miss;
1649 Label index_out_of_range; 1650 Label index_out_of_range;
1650 Label* index_out_of_range_label = &index_out_of_range; 1651 Label* index_out_of_range_label = &index_out_of_range;
1651 1652
1652 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { 1653 if (kind_ == Code::CALL_IC &&
1654 (CallICBase::StringStubState::decode(extra_ic_state_) ==
1655 DEFAULT_STRING_STUB)) {
1653 index_out_of_range_label = &miss; 1656 index_out_of_range_label = &miss;
1654 } 1657 }
1655 1658
1656 GenerateNameCheck(name, &name_miss); 1659 GenerateNameCheck(name, &name_miss);
1657 1660
1658 // Check that the maps starting from the prototype haven't changed. 1661 // Check that the maps starting from the prototype haven't changed.
1659 GenerateDirectLoadGlobalFunctionPrototype(masm(), 1662 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1660 Context::STRING_FUNCTION_INDEX, 1663 Context::STRING_FUNCTION_INDEX,
1661 eax, 1664 eax,
1662 &miss); 1665 &miss);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 return heap()->undefined_value(); 1729 return heap()->undefined_value();
1727 } 1730 }
1728 1731
1729 const int argc = arguments().immediate(); 1732 const int argc = arguments().immediate();
1730 1733
1731 Label miss; 1734 Label miss;
1732 Label name_miss; 1735 Label name_miss;
1733 Label index_out_of_range; 1736 Label index_out_of_range;
1734 Label* index_out_of_range_label = &index_out_of_range; 1737 Label* index_out_of_range_label = &index_out_of_range;
1735 1738
1736 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { 1739 if (kind_ == Code::CALL_IC &&
1740 (CallICBase::StringStubState::decode(extra_ic_state_) ==
1741 DEFAULT_STRING_STUB)) {
1737 index_out_of_range_label = &miss; 1742 index_out_of_range_label = &miss;
1738 } 1743 }
1739 1744
1740 GenerateNameCheck(name, &name_miss); 1745 GenerateNameCheck(name, &name_miss);
1741 1746
1742 // Check that the maps starting from the prototype haven't changed. 1747 // Check that the maps starting from the prototype haven't changed.
1743 GenerateDirectLoadGlobalFunctionPrototype(masm(), 1748 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1744 Context::STRING_FUNCTION_INDEX, 1749 Context::STRING_FUNCTION_INDEX,
1745 eax, 1750 eax,
1746 &miss); 1751 &miss);
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 // Handle load cache miss. 2362 // Handle load cache miss.
2358 __ bind(&miss); 2363 __ bind(&miss);
2359 MaybeObject* maybe_result = GenerateMissBranch(); 2364 MaybeObject* maybe_result = GenerateMissBranch();
2360 if (maybe_result->IsFailure()) return maybe_result; 2365 if (maybe_result->IsFailure()) return maybe_result;
2361 2366
2362 // Return the generated code. 2367 // Return the generated code.
2363 return GetCode(INTERCEPTOR, name); 2368 return GetCode(INTERCEPTOR, name);
2364 } 2369 }
2365 2370
2366 2371
2367 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, 2372 MaybeObject* CallStubCompiler::CompileCallGlobal(
2368 GlobalObject* holder, 2373 JSObject* object,
2369 JSGlobalPropertyCell* cell, 2374 GlobalObject* holder,
2370 JSFunction* function, 2375 JSGlobalPropertyCell* cell,
2371 String* name) { 2376 JSFunction* function,
2377 String* name,
2378 Code::ExtraICState extra_ic_state) {
2372 // ----------- S t a t e ------------- 2379 // ----------- S t a t e -------------
2373 // -- ecx : name 2380 // -- ecx : name
2374 // -- esp[0] : return address 2381 // -- esp[0] : return address
2375 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 2382 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
2376 // -- ... 2383 // -- ...
2377 // -- esp[(argc + 1) * 4] : receiver 2384 // -- esp[(argc + 1) * 4] : receiver
2378 // ----------------------------------- 2385 // -----------------------------------
2379 2386
2380 if (HasCustomCallGenerator(function)) { 2387 if (HasCustomCallGenerator(function)) {
2381 MaybeObject* maybe_result = CompileCustomCall( 2388 MaybeObject* maybe_result = CompileCustomCall(
(...skipping 22 matching lines...) Expand all
2404 } 2411 }
2405 2412
2406 // Setup the context (function already in edi). 2413 // Setup the context (function already in edi).
2407 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 2414 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
2408 2415
2409 // Jump to the cached code (tail call). 2416 // Jump to the cached code (tail call).
2410 Counters* counters = isolate()->counters(); 2417 Counters* counters = isolate()->counters();
2411 __ IncrementCounter(counters->call_global_inline(), 1); 2418 __ IncrementCounter(counters->call_global_inline(), 1);
2412 ASSERT(function->is_compiled()); 2419 ASSERT(function->is_compiled());
2413 ParameterCount expected(function->shared()->formal_parameter_count()); 2420 ParameterCount expected(function->shared()->formal_parameter_count());
2421 ReceiverType receiver_type = CallICBase::Contextual::decode(extra_ic_state)
2422 ? IMPLICIT_RECEIVER
2423 : EXPLICIT_RECEIVER;
2414 if (V8::UseCrankshaft()) { 2424 if (V8::UseCrankshaft()) {
2415 // TODO(kasperl): For now, we always call indirectly through the 2425 // TODO(kasperl): For now, we always call indirectly through the
2416 // code field in the function to allow recompilation to take effect 2426 // code field in the function to allow recompilation to take effect
2417 // without changing any of the call sites. 2427 // without changing any of the call sites.
2418 __ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), 2428 __ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset),
2419 expected, arguments(), JUMP_FUNCTION); 2429 expected, arguments(), JUMP_FUNCTION,
2430 NullCallWrapper(), receiver_type);
2420 } else { 2431 } else {
2421 Handle<Code> code(function->code()); 2432 Handle<Code> code(function->code());
2422 __ InvokeCode(code, expected, arguments(), 2433 __ InvokeCode(code, expected, arguments(),
2423 RelocInfo::CODE_TARGET, JUMP_FUNCTION); 2434 RelocInfo::CODE_TARGET, JUMP_FUNCTION,
2435 NullCallWrapper(), receiver_type);
2424 } 2436 }
2425 2437
2426 // Handle call cache miss. 2438 // Handle call cache miss.
2427 __ bind(&miss); 2439 __ bind(&miss);
2428 __ IncrementCounter(counters->call_global_inline_miss(), 1); 2440 __ IncrementCounter(counters->call_global_inline_miss(), 1);
2429 MaybeObject* maybe_result = GenerateMissBranch(); 2441 MaybeObject* maybe_result = GenerateMissBranch();
2430 if (maybe_result->IsFailure()) return maybe_result; 2442 if (maybe_result->IsFailure()) return maybe_result;
2431 2443
2432 // Return the generated code. 2444 // Return the generated code.
2433 return GetCode(NORMAL, name); 2445 return GetCode(NORMAL, name);
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3675 3687
3676 return GetCode(flags); 3688 return GetCode(flags);
3677 } 3689 }
3678 3690
3679 3691
3680 #undef __ 3692 #undef __
3681 3693
3682 } } // namespace v8::internal 3694 } } // namespace v8::internal
3683 3695
3684 #endif // V8_TARGET_ARCH_IA32 3696 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698