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

Side by Side Diff: src/hydrogen.cc

Issue 7068009: Pass undefined to JS builtins when called with implicit receiver. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update sputnik test expectations. 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/heap.cc ('k') | src/ia32/builtins-ia32.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 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 5866 matching lines...) Expand 10 before | Expand all | Expand 10 after
5877 HValue* push = ExpressionStackAt(arity - i); 5877 HValue* push = ExpressionStackAt(arity - i);
5878 inner->SetValueAt(i, push); 5878 inner->SetValueAt(i, push);
5879 } 5879 }
5880 } else { 5880 } else {
5881 ASSERT(compilation_phase == LITHIUM); 5881 ASSERT(compilation_phase == LITHIUM);
5882 for (int i = 0; i <= arity; ++i) { // Include receiver. 5882 for (int i = 0; i <= arity; ++i) { // Include receiver.
5883 HValue* push = ExpressionStackAt(arity - i); 5883 HValue* push = ExpressionStackAt(arity - i);
5884 inner->SetValueAt(i, push); 5884 inner->SetValueAt(i, push);
5885 } 5885 }
5886 } 5886 }
5887 // If the function we are inlining is a strict mode function, pass 5887 // If the function we are inlining is a strict mode function or a
5888 // undefined as the receiver for function calls (instead of the 5888 // builtin function, pass undefined as the receiver for function
5889 // global receiver). 5889 // calls (instead of the global receiver).
5890 if (function->strict_mode() && call_kind == CALL_AS_FUNCTION) { 5890 if ((target->shared()->native() || function->strict_mode()) &&
5891 call_kind == CALL_AS_FUNCTION) {
5891 inner->SetValueAt(0, undefined); 5892 inner->SetValueAt(0, undefined);
5892 } 5893 }
5893 inner->SetValueAt(arity + 1, outer->LookupContext()); 5894 inner->SetValueAt(arity + 1, outer->LookupContext());
5894 for (int i = arity + 2; i < inner->length(); ++i) { 5895 for (int i = arity + 2; i < inner->length(); ++i) {
5895 inner->SetValueAt(i, undefined); 5896 inner->SetValueAt(i, undefined);
5896 } 5897 }
5897 5898
5898 inner->set_ast_id(AstNode::kFunctionEntryId); 5899 inner->set_ast_id(AstNode::kFunctionEntryId);
5899 return inner; 5900 return inner;
5900 } 5901 }
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
6230 } 6231 }
6231 } 6232 }
6232 6233
6233 #ifdef DEBUG 6234 #ifdef DEBUG
6234 if (graph_ != NULL) graph_->Verify(); 6235 if (graph_ != NULL) graph_->Verify();
6235 if (allocator_ != NULL) allocator_->Verify(); 6236 if (allocator_ != NULL) allocator_->Verify();
6236 #endif 6237 #endif
6237 } 6238 }
6238 6239
6239 } } // namespace v8::internal 6240 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698