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

Side by Side Diff: test/cctest/compiler/test-js-context-specialization.cc

Issue 1478303002: Revert of [runtime] Replace global object link with native context link in all contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/x64/macro-assembler-x64.cc ('k') | test/cctest/interpreter/test-bytecode-generator.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 // TODO(jochen): Remove this after the setting is turned on globally. 5 // TODO(jochen): Remove this after the setting is turned on globally.
6 #define V8_IMMINENT_DEPRECATION_WARNINGS 6 #define V8_IMMINENT_DEPRECATION_WARNINGS
7 7
8 #include "src/compiler/js-context-specialization.h" 8 #include "src/compiler/js-context-specialization.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/js-operator.h" 10 #include "src/compiler/js-operator.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 Node* start = t.graph()->NewNode(t.common()->Start(0)); 58 Node* start = t.graph()->NewNode(t.common()->Start(0));
59 t.graph()->SetStart(start); 59 t.graph()->SetStart(start);
60 60
61 // Make a context and initialize it a bit for this test. 61 // Make a context and initialize it a bit for this test.
62 Handle<Context> native = t.factory()->NewNativeContext(); 62 Handle<Context> native = t.factory()->NewNativeContext();
63 Handle<Context> subcontext1 = t.factory()->NewNativeContext(); 63 Handle<Context> subcontext1 = t.factory()->NewNativeContext();
64 Handle<Context> subcontext2 = t.factory()->NewNativeContext(); 64 Handle<Context> subcontext2 = t.factory()->NewNativeContext();
65 subcontext2->set_previous(*subcontext1); 65 subcontext2->set_previous(*subcontext1);
66 subcontext1->set_previous(*native); 66 subcontext1->set_previous(*native);
67 Handle<Object> expected = t.factory()->InternalizeUtf8String("gboy!"); 67 Handle<Object> expected = t.factory()->InternalizeUtf8String("gboy!");
68 const int slot = Context::NATIVE_CONTEXT_INDEX; 68 const int slot = Context::GLOBAL_OBJECT_INDEX;
69 native->set(slot, *expected); 69 native->set(slot, *expected);
70 70
71 Node* const_context = t.jsgraph()->Constant(native); 71 Node* const_context = t.jsgraph()->Constant(native);
72 Node* deep_const_context = t.jsgraph()->Constant(subcontext2); 72 Node* deep_const_context = t.jsgraph()->Constant(subcontext2);
73 Node* param_context = t.graph()->NewNode(t.common()->Parameter(0), start); 73 Node* param_context = t.graph()->NewNode(t.common()->Parameter(0), start);
74 74
75 { 75 {
76 // Mutable slot, constant context, depth = 0 => do nothing. 76 // Mutable slot, constant context, depth = 0 => do nothing.
77 Node* load = t.graph()->NewNode(t.javascript()->LoadContext(0, 0, false), 77 Node* load = t.graph()->NewNode(t.javascript()->LoadContext(0, 0, false),
78 const_context, const_context, start); 78 const_context, const_context, start);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 Node* start = t.graph()->NewNode(t.common()->Start(0)); 129 Node* start = t.graph()->NewNode(t.common()->Start(0));
130 t.graph()->SetStart(start); 130 t.graph()->SetStart(start);
131 131
132 // Make a context and initialize it a bit for this test. 132 // Make a context and initialize it a bit for this test.
133 Handle<Context> native = t.factory()->NewNativeContext(); 133 Handle<Context> native = t.factory()->NewNativeContext();
134 Handle<Context> subcontext1 = t.factory()->NewNativeContext(); 134 Handle<Context> subcontext1 = t.factory()->NewNativeContext();
135 Handle<Context> subcontext2 = t.factory()->NewNativeContext(); 135 Handle<Context> subcontext2 = t.factory()->NewNativeContext();
136 subcontext2->set_previous(*subcontext1); 136 subcontext2->set_previous(*subcontext1);
137 subcontext1->set_previous(*native); 137 subcontext1->set_previous(*native);
138 Handle<Object> expected = t.factory()->InternalizeUtf8String("gboy!"); 138 Handle<Object> expected = t.factory()->InternalizeUtf8String("gboy!");
139 const int slot = Context::NATIVE_CONTEXT_INDEX; 139 const int slot = Context::GLOBAL_OBJECT_INDEX;
140 native->set(slot, *expected); 140 native->set(slot, *expected);
141 141
142 Node* const_context = t.jsgraph()->Constant(native); 142 Node* const_context = t.jsgraph()->Constant(native);
143 Node* deep_const_context = t.jsgraph()->Constant(subcontext2); 143 Node* deep_const_context = t.jsgraph()->Constant(subcontext2);
144 Node* param_context = t.graph()->NewNode(t.common()->Parameter(0), start); 144 Node* param_context = t.graph()->NewNode(t.common()->Parameter(0), start);
145 145
146 { 146 {
147 // Mutable slot, constant context, depth = 0 => do nothing. 147 // Mutable slot, constant context, depth = 0 => do nothing.
148 Node* load = 148 Node* load =
149 t.graph()->NewNode(t.javascript()->StoreContext(0, 0), const_context, 149 t.graph()->NewNode(t.javascript()->StoreContext(0, 0), const_context,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 TEST(SpecializeToContext) { 198 TEST(SpecializeToContext) {
199 ContextSpecializationTester t; 199 ContextSpecializationTester t;
200 200
201 Node* start = t.graph()->NewNode(t.common()->Start(0)); 201 Node* start = t.graph()->NewNode(t.common()->Start(0));
202 t.graph()->SetStart(start); 202 t.graph()->SetStart(start);
203 203
204 // Make a context and initialize it a bit for this test. 204 // Make a context and initialize it a bit for this test.
205 Handle<Context> native = t.factory()->NewNativeContext(); 205 Handle<Context> native = t.factory()->NewNativeContext();
206 Handle<Object> expected = t.factory()->InternalizeUtf8String("gboy!"); 206 Handle<Object> expected = t.factory()->InternalizeUtf8String("gboy!");
207 const int slot = Context::NATIVE_CONTEXT_INDEX; 207 const int slot = Context::GLOBAL_OBJECT_INDEX;
208 native->set(slot, *expected); 208 native->set(slot, *expected);
209 209
210 Node* const_context = t.jsgraph()->Constant(native); 210 Node* const_context = t.jsgraph()->Constant(native);
211 Node* param_context = t.graph()->NewNode(t.common()->Parameter(0), start); 211 Node* param_context = t.graph()->NewNode(t.common()->Parameter(0), start);
212 212
213 { 213 {
214 // Check that specialization replaces values and forwards effects 214 // Check that specialization replaces values and forwards effects
215 // correctly, and folds values from constant and non-constant contexts 215 // correctly, and folds values from constant and non-constant contexts
216 Node* effect_in = start; 216 Node* effect_in = start;
217 Node* load = t.graph()->NewNode(t.javascript()->LoadContext(0, slot, true), 217 Node* load = t.graph()->NewNode(t.javascript()->LoadContext(0, slot, true),
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); 317 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsNaN());
318 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); 318 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsNaN());
319 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN()); 319 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN());
320 } 320 }
321 } 321 }
322 322
323 } // namespace compiler 323 } // namespace compiler
324 } // namespace internal 324 } // namespace internal
325 } // namespace v8 325 } // namespace v8
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698