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

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

Issue 1238143002: [stubs] Optimize LoadGlobalViaContextStub and StoreGlobalViaContextStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix ARM typo. Created 5 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
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-factory.h" 5 #include "src/code-factory.h"
6 #include "src/code-stubs.h" 6 #include "src/code-stubs.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/js-generic-lowering.h" 8 #include "src/compiler/js-generic-lowering.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 ReplaceWithStubCall(node, callable, flags); 331 ReplaceWithStubCall(node, callable, flags);
332 } 332 }
333 333
334 334
335 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { 335 void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
336 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 336 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
337 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); 337 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op());
338 if (p.slot_index() >= 0) { 338 if (p.slot_index() >= 0) {
339 Callable callable = CodeFactory::LoadGlobalViaContext(isolate(), 0); 339 Callable callable = CodeFactory::LoadGlobalViaContext(isolate(), 0);
340 Node* script_context = node->InputAt(0); 340 Node* script_context = node->InputAt(0);
341 node->ReplaceInput(0, jsgraph()->SmiConstant(0)); 341 node->ReplaceInput(0, jsgraph()->Int32Constant(p.slot_index()));
342 node->ReplaceInput(1, jsgraph()->SmiConstant(p.slot_index())); 342 node->ReplaceInput(1, jsgraph()->HeapConstant(p.name()));
343 node->ReplaceInput(2, jsgraph()->HeapConstant(p.name())); 343 node->ReplaceInput(2, script_context); // Set new context...
344 node->ReplaceInput(3, script_context); // Replace old context. 344 node->RemoveInput(3); // ...instead of old one.
345 ReplaceWithStubCall(node, callable, flags); 345 ReplaceWithStubCall(node, callable, flags);
346 346
347 } else { 347 } else {
348 Callable callable = CodeFactory::LoadICInOptimizedCode( 348 Callable callable = CodeFactory::LoadICInOptimizedCode(
349 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED); 349 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED);
350 node->RemoveInput(0); // script context 350 node->RemoveInput(0); // script context
351 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); 351 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
352 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); 352 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
353 ReplaceWithStubCall(node, callable, flags); 353 ReplaceWithStubCall(node, callable, flags);
354 } 354 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 390
391 391
392 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { 392 void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
393 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 393 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
394 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); 394 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op());
395 if (p.slot_index() >= 0) { 395 if (p.slot_index() >= 0) {
396 Callable callable = 396 Callable callable =
397 CodeFactory::StoreGlobalViaContext(isolate(), 0, p.language_mode()); 397 CodeFactory::StoreGlobalViaContext(isolate(), 0, p.language_mode());
398 Node* script_context = node->InputAt(0); 398 Node* script_context = node->InputAt(0);
399 Node* value = node->InputAt(2); 399 Node* value = node->InputAt(2);
400 node->ReplaceInput(0, jsgraph()->SmiConstant(0)); 400 node->ReplaceInput(0, jsgraph()->Int32Constant(p.slot_index()));
401 node->ReplaceInput(1, jsgraph()->SmiConstant(p.slot_index())); 401 node->ReplaceInput(1, jsgraph()->HeapConstant(p.name()));
402 node->ReplaceInput(2, jsgraph()->HeapConstant(p.name())); 402 node->ReplaceInput(2, value);
403 node->ReplaceInput(3, value); 403 node->ReplaceInput(3, script_context); // Set new context...
404 node->ReplaceInput(4, script_context); // Replace old context. 404 node->RemoveInput(4); // ...instead of old one.
405 ReplaceWithStubCall(node, callable, flags); 405 ReplaceWithStubCall(node, callable, flags);
406 406
407 } else { 407 } else {
408 Callable callable = CodeFactory::StoreIC(isolate(), p.language_mode()); 408 Callable callable = CodeFactory::StoreIC(isolate(), p.language_mode());
409 node->RemoveInput(0); // script context 409 node->RemoveInput(0); // script context
410 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); 410 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
411 if (FLAG_vector_stores) { 411 if (FLAG_vector_stores) {
412 DCHECK(p.feedback().index() != -1); 412 DCHECK(p.feedback().index() != -1);
413 node->InsertInput(zone(), 3, 413 node->InsertInput(zone(), 3,
414 jsgraph()->SmiConstant(p.feedback().index())); 414 jsgraph()->SmiConstant(p.feedback().index()));
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 } 841 }
842 842
843 843
844 MachineOperatorBuilder* JSGenericLowering::machine() const { 844 MachineOperatorBuilder* JSGenericLowering::machine() const {
845 return jsgraph()->machine(); 845 return jsgraph()->machine();
846 } 846 }
847 847
848 } // namespace compiler 848 } // namespace compiler
849 } // namespace internal 849 } // namespace internal
850 } // namespace v8 850 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698