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

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

Issue 1227893005: TypeofMode replaces TypeofState and ContextualMode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments 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
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/js-operator.h » ('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-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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 isolate(), p.language_mode(), UNINITIALIZED); 318 isolate(), p.language_mode(), UNINITIALIZED);
319 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); 319 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
320 ReplaceWithStubCall(node, callable, flags); 320 ReplaceWithStubCall(node, callable, flags);
321 } 321 }
322 322
323 323
324 void JSGenericLowering::LowerJSLoadNamed(Node* node) { 324 void JSGenericLowering::LowerJSLoadNamed(Node* node) {
325 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 325 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
326 const LoadNamedParameters& p = LoadNamedParametersOf(node->op()); 326 const LoadNamedParameters& p = LoadNamedParametersOf(node->op());
327 Callable callable = CodeFactory::LoadICInOptimizedCode( 327 Callable callable = CodeFactory::LoadICInOptimizedCode(
328 isolate(), p.contextual_mode(), p.language_mode(), UNINITIALIZED); 328 isolate(), NOT_INSIDE_TYPEOF, p.language_mode(), UNINITIALIZED);
329 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); 329 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
330 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); 330 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
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()->SmiConstant(0));
342 node->ReplaceInput(1, jsgraph()->SmiConstant(p.slot_index())); 342 node->ReplaceInput(1, jsgraph()->SmiConstant(p.slot_index()));
343 node->ReplaceInput(2, jsgraph()->HeapConstant(p.name())); 343 node->ReplaceInput(2, jsgraph()->HeapConstant(p.name()));
344 node->ReplaceInput(3, script_context); // Replace old context. 344 node->ReplaceInput(3, script_context); // Replace old context.
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.contextual_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 }
355 } 355 }
356 356
357 357
358 void JSGenericLowering::LowerJSStoreProperty(Node* node) { 358 void JSGenericLowering::LowerJSStoreProperty(Node* node) {
359 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 359 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( 476 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset(
477 static_cast<int>(access.index())))); 477 static_cast<int>(access.index()))));
478 node->set_op( 478 node->set_op(
479 machine()->Store(StoreRepresentation(kMachAnyTagged, kFullWriteBarrier))); 479 machine()->Store(StoreRepresentation(kMachAnyTagged, kFullWriteBarrier)));
480 } 480 }
481 481
482 482
483 void JSGenericLowering::LowerJSLoadDynamicGlobal(Node* node) { 483 void JSGenericLowering::LowerJSLoadDynamicGlobal(Node* node) {
484 const DynamicGlobalAccess& access = DynamicGlobalAccessOf(node->op()); 484 const DynamicGlobalAccess& access = DynamicGlobalAccessOf(node->op());
485 Runtime::FunctionId function_id = 485 Runtime::FunctionId function_id =
486 (access.mode() == CONTEXTUAL) ? Runtime::kLoadLookupSlot 486 (access.typeof_mode() == NOT_INSIDE_TYPEOF)
487 : Runtime::kLoadLookupSlotNoReferenceError; 487 ? Runtime::kLoadLookupSlot
488 : Runtime::kLoadLookupSlotNoReferenceError;
488 Node* projection = graph()->NewNode(common()->Projection(0), node); 489 Node* projection = graph()->NewNode(common()->Projection(0), node);
489 NodeProperties::ReplaceUses(node, projection, node, node, node); 490 NodeProperties::ReplaceUses(node, projection, node, node, node);
490 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1); 491 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1);
491 node->RemoveInput(NodeProperties::FirstValueIndex(node)); 492 node->RemoveInput(NodeProperties::FirstValueIndex(node));
492 node->InsertInput(zone(), 1, jsgraph()->Constant(access.name())); 493 node->InsertInput(zone(), 1, jsgraph()->Constant(access.name()));
493 ReplaceWithRuntimeCall(node, function_id); 494 ReplaceWithRuntimeCall(node, function_id);
494 projection->ReplaceInput(0, node); 495 projection->ReplaceInput(0, node);
495 } 496 }
496 497
497 498
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 } 838 }
838 839
839 840
840 MachineOperatorBuilder* JSGenericLowering::machine() const { 841 MachineOperatorBuilder* JSGenericLowering::machine() const {
841 return jsgraph()->machine(); 842 return jsgraph()->machine();
842 } 843 }
843 844
844 } // namespace compiler 845 } // namespace compiler
845 } // namespace internal 846 } // namespace internal
846 } // namespace v8 847 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698