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

Side by Side Diff: src/compiler/js-global-object-specialization.cc

Issue 2646363003: [turbofan] Add fast path for cached property names. (Closed)
Patch Set: Test from jochen. Created 3 years, 11 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/access-info.cc ('k') | test/cctest/cctest.status » ('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 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-global-object-specialization.h" 5 #include "src/compiler/js-global-object-specialization.h"
6 6
7 #include "src/compilation-dependencies.h" 7 #include "src/compilation-dependencies.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 if (representation == MachineRepresentation::kTaggedSigned) { 55 if (representation == MachineRepresentation::kTaggedSigned) {
56 kind = kNoWriteBarrier; 56 kind = kNoWriteBarrier;
57 } else if (representation == MachineRepresentation::kTaggedPointer) { 57 } else if (representation == MachineRepresentation::kTaggedPointer) {
58 kind = kPointerWriteBarrier; 58 kind = kPointerWriteBarrier;
59 } 59 }
60 MachineType r = MachineType::TypeForRepresentation(representation); 60 MachineType r = MachineType::TypeForRepresentation(representation);
61 FieldAccess access = { 61 FieldAccess access = {
62 kTaggedBase, PropertyCell::kValueOffset, name, map, type, r, kind}; 62 kTaggedBase, PropertyCell::kValueOffset, name, map, type, r, kind};
63 return access; 63 return access;
64 } 64 }
65
65 } // namespace 66 } // namespace
66 67
67 Reduction JSGlobalObjectSpecialization::ReduceJSLoadGlobal(Node* node) { 68 Reduction JSGlobalObjectSpecialization::ReduceJSLoadGlobal(Node* node) {
68 DCHECK_EQ(IrOpcode::kJSLoadGlobal, node->opcode()); 69 DCHECK_EQ(IrOpcode::kJSLoadGlobal, node->opcode());
69 Handle<Name> name = LoadGlobalParametersOf(node->op()).name(); 70 Handle<Name> name = LoadGlobalParametersOf(node->op()).name();
70 Node* effect = NodeProperties::GetEffectInput(node); 71 Node* effect = NodeProperties::GetEffectInput(node);
71 Node* control = NodeProperties::GetControlInput(node); 72 Node* control = NodeProperties::GetControlInput(node);
72 73
73 // Try to lookup the name on the script context table first (lexical scoping). 74 // Try to lookup the name on the script context table first (lexical scoping).
74 ScriptContextTableLookupResult result; 75 ScriptContextTableLookupResult result;
75 if (LookupInScriptContextTable(name, &result)) { 76 if (LookupInScriptContextTable(name, &result)) {
76 if (result.context->is_the_hole(isolate(), result.index)) return NoChange(); 77 if (result.context->is_the_hole(isolate(), result.index)) return NoChange();
77 Node* context = jsgraph()->HeapConstant(result.context); 78 Node* context = jsgraph()->HeapConstant(result.context);
78 Node* value = effect = graph()->NewNode( 79 Node* value = effect = graph()->NewNode(
79 javascript()->LoadContext(0, result.index, result.immutable), context, 80 javascript()->LoadContext(0, result.index, result.immutable), context,
80 effect); 81 effect);
81 ReplaceWithValue(node, value, effect); 82 ReplaceWithValue(node, value, effect);
82 return Replace(value); 83 return Replace(value);
83 } 84 }
84 85
85 // Lookup on the global object instead. We only deal with own data 86 // Lookup on the global object instead. We only deal with own data
86 // properties of the global object here (represented as PropertyCell). 87 // properties of the global object here (represented as PropertyCell).
87 LookupIterator it(global_object(), name, LookupIterator::OWN); 88 LookupIterator it(global_object(), name, LookupIterator::OWN);
89 it.TryLookupCachedProperty();
88 if (it.state() != LookupIterator::DATA) return NoChange(); 90 if (it.state() != LookupIterator::DATA) return NoChange();
89 if (!it.GetHolder<JSObject>()->IsJSGlobalObject()) return NoChange(); 91 if (!it.GetHolder<JSObject>()->IsJSGlobalObject()) return NoChange();
90 Handle<PropertyCell> property_cell = it.GetPropertyCell(); 92 Handle<PropertyCell> property_cell = it.GetPropertyCell();
91 PropertyDetails property_details = property_cell->property_details(); 93 PropertyDetails property_details = property_cell->property_details();
92 Handle<Object> property_cell_value(property_cell->value(), isolate()); 94 Handle<Object> property_cell_value(property_cell->value(), isolate());
93 95
94 // Load from non-configurable, read-only data property on the global 96 // Load from non-configurable, read-only data property on the global
95 // object can be constant-folded, even without deoptimization support. 97 // object can be constant-folded, even without deoptimization support.
96 if (!property_details.IsConfigurable() && property_details.IsReadOnly()) { 98 if (!property_details.IsConfigurable() && property_details.IsReadOnly()) {
97 Node* value = jsgraph()->Constant(property_cell_value); 99 Node* value = jsgraph()->Constant(property_cell_value);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 return jsgraph()->javascript(); 287 return jsgraph()->javascript();
286 } 288 }
287 289
288 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { 290 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const {
289 return jsgraph()->simplified(); 291 return jsgraph()->simplified();
290 } 292 }
291 293
292 } // namespace compiler 294 } // namespace compiler
293 } // namespace internal 295 } // namespace internal
294 } // namespace v8 296 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/access-info.cc ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698