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

Side by Side Diff: src/compiler/js-generic-lowering.cc

Issue 433853002: Implement lowering of JSLoadContext to machine operators. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Ben Titzer. Created 6 years, 4 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 | « no previous file | src/compiler/pipeline.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/code-stubs.h" 5 #include "src/code-stubs.h"
6 #include "src/compiler/common-operator.h" 6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/graph-inl.h" 7 #include "src/compiler/graph-inl.h"
8 #include "src/compiler/js-generic-lowering.h" 8 #include "src/compiler/js-generic-lowering.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-aux-data-inl.h" 10 #include "src/compiler/node-aux-data-inl.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, 0); 363 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, 0);
364 Node* stub_code = CodeConstant(stub.GetCode()); 364 Node* stub_code = CodeConstant(stub.GetCode());
365 PatchInsertInput(node, 0, stub_code); 365 PatchInsertInput(node, 0, stub_code);
366 PatchOperator(node, common()->Call(desc)); 366 PatchOperator(node, common()->Call(desc));
367 return node; 367 return node;
368 } 368 }
369 369
370 370
371 Node* JSGenericLowering::LowerJSLoadContext(Node* node) { 371 Node* JSGenericLowering::LowerJSLoadContext(Node* node) {
372 ContextAccess access = OpParameter<ContextAccess>(node); 372 ContextAccess access = OpParameter<ContextAccess>(node);
373 PatchInsertInput(node, 1, SmiConstant(access.depth())); 373 // TODO(mstarzinger): Use simplified operators instead of machine operators
374 PatchInsertInput(node, 2, SmiConstant(access.index())); 374 // here so that load/store optimization can be applied afterwards.
375 ReplaceWithRuntimeCall(node, Runtime::kLoadContextRelative, 3); 375 for (int i = 0; i < access.depth(); ++i) {
376 node->ReplaceInput(
377 0, graph()->NewNode(
378 machine()->Load(kMachineTagged),
379 NodeProperties::GetValueInput(node, 0),
380 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
381 NodeProperties::GetEffectInput(node)));
382 }
383 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index())));
384 PatchOperator(node, machine()->Load(kMachineTagged));
376 return node; 385 return node;
377 } 386 }
378 387
379 388
380 Node* JSGenericLowering::LowerJSStoreContext(Node* node) { 389 Node* JSGenericLowering::LowerJSStoreContext(Node* node) {
381 ContextAccess access = OpParameter<ContextAccess>(node); 390 ContextAccess access = OpParameter<ContextAccess>(node);
382 PatchInsertInput(node, 1, SmiConstant(access.depth())); 391 PatchInsertInput(node, 1, SmiConstant(access.depth()));
383 PatchInsertInput(node, 2, SmiConstant(access.index())); 392 PatchInsertInput(node, 2, SmiConstant(access.index()));
384 ReplaceWithRuntimeCall(node, Runtime::kStoreContextRelative, 4); 393 ReplaceWithRuntimeCall(node, Runtime::kStoreContextRelative, 4);
385 return node; 394 return node;
(...skipping 30 matching lines...) Expand all
416 425
417 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { 426 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) {
418 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); 427 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node);
419 int arity = NodeProperties::GetValueInputCount(node); 428 int arity = NodeProperties::GetValueInputCount(node);
420 ReplaceWithRuntimeCall(node, function, arity); 429 ReplaceWithRuntimeCall(node, function, arity);
421 return node; 430 return node;
422 } 431 }
423 } 432 }
424 } 433 }
425 } // namespace v8::internal::compiler 434 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « no previous file | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698