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

Side by Side Diff: src/compiler/js-native-context-specialization.cc

Issue 2830633002: [turbofan] Create initial map on-demand for F.prototype. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/js-native-context-specialization.h" 5 #include "src/compiler/js-native-context-specialization.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 Node* const receiver = NodeProperties::GetValueInput(node, 0); 819 Node* const receiver = NodeProperties::GetValueInput(node, 0);
820 Node* const value = jsgraph()->Dead(); 820 Node* const value = jsgraph()->Dead();
821 821
822 // Check if we have a constant receiver. 822 // Check if we have a constant receiver.
823 HeapObjectMatcher m(receiver); 823 HeapObjectMatcher m(receiver);
824 if (m.HasValue()) { 824 if (m.HasValue()) {
825 if (m.Value()->IsJSFunction() && 825 if (m.Value()->IsJSFunction() &&
826 p.name().is_identical_to(factory()->prototype_string())) { 826 p.name().is_identical_to(factory()->prototype_string())) {
827 // Optimize "prototype" property of functions. 827 // Optimize "prototype" property of functions.
828 Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value()); 828 Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value());
829 if (function->has_initial_map()) { 829 // We need to add a code dependency on the initial map of the
830 // We need to add a code dependency on the initial map of the 830 // {function} in order to be notified about changes to the
831 // {function} in order to be notified about changes to the 831 // "prototype" of {function}.
832 // "prototype" of {function}, so it doesn't make sense to 832 JSFunction::EnsureHasInitialMap(function);
Michael Starzinger 2017/04/19 10:38:58 The function must be constructible. The following
833 // continue unless deoptimization is enabled. 833 Handle<Map> initial_map(function->initial_map(), isolate());
834 Handle<Map> initial_map(function->initial_map(), isolate()); 834 dependencies()->AssumeInitialMapCantChange(initial_map);
835 dependencies()->AssumeInitialMapCantChange(initial_map); 835 Handle<Object> prototype(function->prototype(), isolate());
836 Handle<Object> prototype(function->prototype(), isolate()); 836 Node* value = jsgraph()->Constant(prototype);
837 Node* value = jsgraph()->Constant(prototype); 837 ReplaceWithValue(node, value);
838 ReplaceWithValue(node, value); 838 return Replace(value);
839 return Replace(value);
840 }
841 } else if (m.Value()->IsString() && 839 } else if (m.Value()->IsString() &&
842 p.name().is_identical_to(factory()->length_string())) { 840 p.name().is_identical_to(factory()->length_string())) {
843 // Constant-fold "length" property on constant strings. 841 // Constant-fold "length" property on constant strings.
844 Handle<String> string = Handle<String>::cast(m.Value()); 842 Handle<String> string = Handle<String>::cast(m.Value());
845 Node* value = jsgraph()->Constant(string->length()); 843 Node* value = jsgraph()->Constant(string->length());
846 ReplaceWithValue(node, value); 844 ReplaceWithValue(node, value);
847 return Replace(value); 845 return Replace(value);
848 } 846 }
849 } 847 }
850 848
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
2350 return jsgraph()->javascript(); 2348 return jsgraph()->javascript();
2351 } 2349 }
2352 2350
2353 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { 2351 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const {
2354 return jsgraph()->simplified(); 2352 return jsgraph()->simplified();
2355 } 2353 }
2356 2354
2357 } // namespace compiler 2355 } // namespace compiler
2358 } // namespace internal 2356 } // namespace internal
2359 } // namespace v8 2357 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698