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

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

Issue 1244583003: [turbofan]: Add a context relaxer reducer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Latest Created 5 years, 5 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/compiler/frame-states.h"
6 #include "src/compiler/js-context-relaxation.h"
7 #include "src/compiler/js-operator.h"
8 #include "src/compiler/node.h"
9 #include "src/compiler/node-properties.h"
10
11 namespace v8 {
12 namespace internal {
13 namespace compiler {
14
15 Reduction JSContextRelaxation::Reduce(Node* node) {
16 switch (node->opcode()) {
17 case IrOpcode::kJSCallFunction:
18 case IrOpcode::kJSToNumber: {
19 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0);
20 Node* outer_frame = frame_state;
21 Node* outer_frame_context = nullptr;
22 do {
23 FrameStateInfo frame_state_info(
24 OpParameter<FrameStateInfo>(outer_frame->op()));
25 const FrameStateFunctionInfo* function_info =
26 frame_state_info.function_info();
27 if (function_info == nullptr ||
28 (function_info->context_calling_mode() ==
29 CALL_CHANGES_NATIVE_CONTEXT)) {
30 return NoChange();
Michael Starzinger 2015/07/20 08:09:49 Could we just break when we hit a context-changing
danno 2015/07/20 15:27:33 Done
31 }
32 outer_frame_context = outer_frame->InputAt(kFrameStateContextInput);
33 outer_frame = outer_frame->InputAt(kFrameStateOuterStateInput);
34 } while (outer_frame->opcode() == IrOpcode::kFrameState);
35
36 while (true) {
37 switch (outer_frame_context->opcode()) {
38 case IrOpcode::kParameter:
39 case IrOpcode::kJSCreateModuleContext:
40 case IrOpcode::kJSCreateScriptContext:
41 NodeProperties::ReplaceContextInput(node, outer_frame_context);
42 return Changed(node);
43 case IrOpcode::kJSCreateCatchContext:
44 case IrOpcode::kJSCreateWithContext:
45 case IrOpcode::kJSCreateBlockContext:
46 outer_frame_context =
47 NodeProperties::GetContextInput(outer_frame_context);
48 break;
49 default:
50 return NoChange();
51 }
52 }
53 }
54 default:
55 break;
56 }
57 return NoChange();
58 }
59
60 } // namespace compiler
61 } // namespace internal
62 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698