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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1312713004: Remove CompilationInfo::MayUseThis() and replace it with what we really want to know: MustReplaceUn… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « src/compiler.cc ('k') | src/full-codegen/arm/full-codegen-arm.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 3078 matching lines...) Expand 10 before | Expand all | Expand 10 after
3089 } 3089 }
3090 Node* value = NewNode(op, arity, all); 3090 Node* value = NewNode(op, arity, all);
3091 return value; 3091 return value;
3092 } 3092 }
3093 3093
3094 3094
3095 Node* AstGraphBuilder::BuildPatchReceiverToGlobalProxy(Node* receiver) { 3095 Node* AstGraphBuilder::BuildPatchReceiverToGlobalProxy(Node* receiver) {
3096 // Sloppy mode functions and builtins need to replace the receiver with the 3096 // Sloppy mode functions and builtins need to replace the receiver with the
3097 // global proxy when called as functions (without an explicit receiver 3097 // global proxy when called as functions (without an explicit receiver
3098 // object). Otherwise there is nothing left to do here. 3098 // object). Otherwise there is nothing left to do here.
3099 if (is_strict(language_mode()) || info()->is_native()) return receiver; 3099 if (info()->MustReplaceUndefinedReceiverWithGlobalProxy()) {
3100 3100 IfBuilder receiver_check(this);
3101 // There is no need to perform patching if the receiver will never be used. 3101 Node* undefined = jsgraph()->UndefinedConstant();
3102 if (!info()->MayUseThis()) return receiver; 3102 Node* check = NewNode(javascript()->StrictEqual(), receiver, undefined);
3103 3103 receiver_check.If(check);
3104 IfBuilder receiver_check(this); 3104 receiver_check.Then();
3105 Node* undefined = jsgraph()->UndefinedConstant(); 3105 Node* proxy = BuildLoadGlobalProxy();
3106 Node* check = NewNode(javascript()->StrictEqual(), receiver, undefined); 3106 environment()->Push(proxy);
3107 receiver_check.If(check); 3107 receiver_check.Else();
3108 receiver_check.Then(); 3108 environment()->Push(receiver);
3109 Node* proxy = BuildLoadGlobalProxy(); 3109 receiver_check.End();
3110 environment()->Push(proxy); 3110 return environment()->Pop();
3111 receiver_check.Else(); 3111 } else {
3112 environment()->Push(receiver); 3112 return receiver;
3113 receiver_check.End(); 3113 }
3114 return environment()->Pop();
3115 } 3114 }
3116 3115
3117 3116
3118 Node* AstGraphBuilder::BuildLocalFunctionContext(Node* context) { 3117 Node* AstGraphBuilder::BuildLocalFunctionContext(Node* context) {
3119 Scope* scope = info()->scope(); 3118 Scope* scope = info()->scope();
3120 Node* closure = GetFunctionClosure(); 3119 Node* closure = GetFunctionClosure();
3121 3120
3122 // Allocate a new local context. 3121 // Allocate a new local context.
3123 Node* local_context = 3122 Node* local_context =
3124 scope->is_script_scope() 3123 scope->is_script_scope()
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
4294 // Phi does not exist yet, introduce one. 4293 // Phi does not exist yet, introduce one.
4295 value = NewPhi(inputs, value, control); 4294 value = NewPhi(inputs, value, control);
4296 value->ReplaceInput(inputs - 1, other); 4295 value->ReplaceInput(inputs - 1, other);
4297 } 4296 }
4298 return value; 4297 return value;
4299 } 4298 }
4300 4299
4301 } // namespace compiler 4300 } // namespace compiler
4302 } // namespace internal 4301 } // namespace internal
4303 } // namespace v8 4302 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698