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

Unified Diff: src/hydrogen.cc

Issue 7622014: Merge r8072 and r8884 to 3.2. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.2/
Patch Set: Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
===================================================================
--- src/hydrogen.cc (revision 8902)
+++ src/hydrogen.cc (working copy)
@@ -3794,6 +3794,13 @@
return false;
}
+ // Our implementation of arguments (based on this stack frame or an
+ // adapter below it) does not work for inlined functions.
+ if (function_state()->outer() != NULL) {
+ Bailout("arguments access in inlined function");
+ return true;
+ }
+
HInstruction* result = NULL;
if (expr->key()->IsPropertyName()) {
Handle<String> name = expr->key()->AsLiteral()->AsPropertyName();
@@ -4315,11 +4322,18 @@
Property* prop = callee->AsProperty();
ASSERT(prop != NULL);
+ if (!expr->IsMonomorphic() || expr->check_type() != RECEIVER_MAP_CHECK) {
+ return false;
+ }
+ Handle<Map> function_map = expr->GetReceiverTypes()->first();
+ if (function_map->instance_type() != JS_FUNCTION_TYPE ||
+ !expr->target()->shared()->HasBuiltinFunctionId() ||
+ expr->target()->shared()->builtin_function_id() != kFunctionApply) {
+ return false;
+ }
+
if (info()->scope()->arguments() == NULL) return false;
- Handle<String> name = prop->key()->AsLiteral()->AsPropertyName();
- if (!name->IsEqualTo(CStrVector("apply"))) return false;
-
ZoneList<Expression*>* args = expr->arguments();
if (args->length() != 2) return false;
@@ -4328,8 +4342,12 @@
HValue* arg_two_value = environment()->Lookup(arg_two->var());
if (!arg_two_value->CheckFlag(HValue::kIsArguments)) return false;
- if (!expr->IsMonomorphic() ||
- expr->check_type() != RECEIVER_MAP_CHECK) return false;
+ // Our implementation of arguments (based on this stack frame or an
+ // adapter below it) does not work for inlined functions.
+ if (function_state()->outer() != NULL) {
+ Bailout("Function.prototype.apply optimization in inlined function");
+ return true;
+ }
// Found pattern f.apply(receiver, arguments).
VisitForValue(prop->obj());
@@ -4340,10 +4358,7 @@
HValue* receiver = Pop();
HInstruction* elements = AddInstruction(new(zone()) HArgumentsElements);
HInstruction* length = AddInstruction(new(zone()) HArgumentsLength(elements));
- AddCheckConstantFunction(expr,
- function,
- expr->GetReceiverTypes()->first(),
- true);
+ AddCheckConstantFunction(expr, function, function_map, true);
HInstruction* result =
new(zone()) HApplyArguments(function, receiver, length, elements);
result->set_position(expr->position());
@@ -5274,6 +5289,10 @@
// Support for arguments.length and arguments[?].
void HGraphBuilder::GenerateArgumentsLength(CallRuntime* call) {
+ // Our implementation of arguments (based on this stack frame or an
+ // adapter below it) does not work for inlined functions. This runtime
+ // function is blacklisted by AstNode::IsInlineable.
+ ASSERT(function_state()->outer() == NULL);
ASSERT(call->arguments()->length() == 0);
HInstruction* elements = AddInstruction(new(zone()) HArgumentsElements);
HArgumentsLength* result = new(zone()) HArgumentsLength(elements);
@@ -5282,6 +5301,10 @@
void HGraphBuilder::GenerateArguments(CallRuntime* call) {
+ // Our implementation of arguments (based on this stack frame or an
+ // adapter below it) does not work for inlined functions. This runtime
+ // function is blacklisted by AstNode::IsInlineable.
+ ASSERT(function_state()->outer() == NULL);
ASSERT(call->arguments()->length() == 1);
VISIT_FOR_VALUE(call->arguments()->at(0));
HValue* index = Pop();
« no previous file with comments | « src/hydrogen.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698