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

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

Issue 613683002: [turbofan] Some javascript operators are globally shared singletons. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 years, 2 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/runtime/runtime.h ('k') | test/cctest/compiler/test-machine-operator-reducer.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/js-context-specialization.h" 5 #include "src/compiler/js-context-specialization.h"
6 #include "src/compiler/js-operator.h" 6 #include "src/compiler/js-operator.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/node-properties-inl.h" 8 #include "src/compiler/node-properties-inl.h"
9 #include "src/compiler/source-position.h" 9 #include "src/compiler/source-position.h"
10 #include "src/compiler/typer.h" 10 #include "src/compiler/typer.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 Node* load = t.NewNode( 88 Node* load = t.NewNode(
89 t.javascript()->LoadContext(2, Context::GLOBAL_EVAL_FUN_INDEX, false), 89 t.javascript()->LoadContext(2, Context::GLOBAL_EVAL_FUN_INDEX, false),
90 deep_const_context, deep_const_context, start); 90 deep_const_context, deep_const_context, start);
91 Reduction r = spec.ReduceJSLoadContext(load); 91 Reduction r = spec.ReduceJSLoadContext(load);
92 CHECK(r.Changed()); 92 CHECK(r.Changed());
93 Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0); 93 Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0);
94 CHECK_EQ(IrOpcode::kHeapConstant, new_context_input->opcode()); 94 CHECK_EQ(IrOpcode::kHeapConstant, new_context_input->opcode());
95 HeapObjectMatcher<Context> match(new_context_input); 95 HeapObjectMatcher<Context> match(new_context_input);
96 CHECK_EQ(*native, *match.Value().handle()); 96 CHECK_EQ(*native, *match.Value().handle());
97 ContextAccess access = OpParameter<ContextAccess>(r.replacement()); 97 ContextAccess access = OpParameter<ContextAccess>(r.replacement());
98 CHECK_EQ(Context::GLOBAL_EVAL_FUN_INDEX, access.index()); 98 CHECK_EQ(Context::GLOBAL_EVAL_FUN_INDEX, static_cast<int>(access.index()));
99 CHECK_EQ(0, access.depth()); 99 CHECK_EQ(0, static_cast<int>(access.depth()));
100 CHECK_EQ(false, access.immutable()); 100 CHECK_EQ(false, access.immutable());
101 } 101 }
102 102
103 { 103 {
104 // Immutable slot, constant context, depth = 0 => specialize. 104 // Immutable slot, constant context, depth = 0 => specialize.
105 Node* load = t.NewNode(t.javascript()->LoadContext(0, slot, true), 105 Node* load = t.NewNode(t.javascript()->LoadContext(0, slot, true),
106 const_context, const_context, start); 106 const_context, const_context, start);
107 Reduction r = spec.ReduceJSLoadContext(load); 107 Reduction r = spec.ReduceJSLoadContext(load);
108 CHECK(r.Changed()); 108 CHECK(r.Changed());
109 CHECK(r.replacement() != load); 109 CHECK(r.replacement() != load);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 Node* load = t.NewNode( 168 Node* load = t.NewNode(
169 t.javascript()->StoreContext(2, Context::GLOBAL_EVAL_FUN_INDEX), 169 t.javascript()->StoreContext(2, Context::GLOBAL_EVAL_FUN_INDEX),
170 deep_const_context, deep_const_context, start); 170 deep_const_context, deep_const_context, start);
171 Reduction r = spec.ReduceJSStoreContext(load); 171 Reduction r = spec.ReduceJSStoreContext(load);
172 CHECK(r.Changed()); 172 CHECK(r.Changed());
173 Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0); 173 Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0);
174 CHECK_EQ(IrOpcode::kHeapConstant, new_context_input->opcode()); 174 CHECK_EQ(IrOpcode::kHeapConstant, new_context_input->opcode());
175 HeapObjectMatcher<Context> match(new_context_input); 175 HeapObjectMatcher<Context> match(new_context_input);
176 CHECK_EQ(*native, *match.Value().handle()); 176 CHECK_EQ(*native, *match.Value().handle());
177 ContextAccess access = OpParameter<ContextAccess>(r.replacement()); 177 ContextAccess access = OpParameter<ContextAccess>(r.replacement());
178 CHECK_EQ(Context::GLOBAL_EVAL_FUN_INDEX, access.index()); 178 CHECK_EQ(Context::GLOBAL_EVAL_FUN_INDEX, static_cast<int>(access.index()));
179 CHECK_EQ(0, access.depth()); 179 CHECK_EQ(0, static_cast<int>(access.depth()));
180 CHECK_EQ(false, access.immutable()); 180 CHECK_EQ(false, access.immutable());
181 } 181 }
182 } 182 }
183 183
184 184
185 // TODO(titzer): factor out common code with effects checking in typed lowering. 185 // TODO(titzer): factor out common code with effects checking in typed lowering.
186 static void CheckEffectInput(Node* effect, Node* use) { 186 static void CheckEffectInput(Node* effect, Node* use) {
187 CHECK_EQ(effect, NodeProperties::GetEffectInput(use)); 187 CHECK_EQ(effect, NodeProperties::GetEffectInput(use));
188 } 188 }
189 189
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 { 298 {
299 FunctionTester T( 299 FunctionTester T(
300 "(function() { if (false) { var x = 1; } function inc(a)" 300 "(function() { if (false) { var x = 1; } function inc(a)"
301 " { return a + x; } return inc; })()"); // x is undefined! 301 " { return a + x; } return inc; })()"); // x is undefined!
302 302
303 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); 303 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsNaN());
304 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); 304 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsNaN());
305 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN()); 305 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN());
306 } 306 }
307 } 307 }
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/compiler/test-machine-operator-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698