OLD | NEW |
---|---|
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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 isolate(), NOT_INSIDE_TYPEOF, p.language_mode(), UNINITIALIZED); | 301 isolate(), NOT_INSIDE_TYPEOF, p.language_mode(), UNINITIALIZED); |
302 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 302 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
303 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 303 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
304 ReplaceWithStubCall(node, callable, flags); | 304 ReplaceWithStubCall(node, callable, flags); |
305 } | 305 } |
306 | 306 |
307 | 307 |
308 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { | 308 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { |
309 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 309 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
310 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); | 310 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); |
311 if (p.slot_index() >= 0) { | 311 Callable callable = CodeFactory::LoadICInOptimizedCode( |
312 Callable callable = CodeFactory::LoadGlobalViaContext(isolate(), 0); | 312 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED); |
313 Node* script_context = node->InputAt(0); | 313 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
314 node->ReplaceInput(0, jsgraph()->Int32Constant(p.slot_index())); | 314 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
315 node->ReplaceInput(1, script_context); // Set new context... | 315 ReplaceWithStubCall(node, callable, flags); |
Benedikt Meurer
2015/10/22 05:03:52
Insert the global object here, loading it from the
Igor Sheludko
2015/10/22 08:49:52
Done.
| |
316 node->RemoveInput(2); | |
317 node->RemoveInput(2); // ...instead of old one. | |
318 ReplaceWithStubCall(node, callable, flags); | |
319 | |
320 } else { | |
321 Callable callable = CodeFactory::LoadICInOptimizedCode( | |
322 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED); | |
323 node->RemoveInput(0); // script context | |
324 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | |
325 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | |
326 ReplaceWithStubCall(node, callable, flags); | |
327 } | |
328 } | 316 } |
329 | 317 |
330 | 318 |
331 void JSGenericLowering::LowerJSStoreProperty(Node* node) { | 319 void JSGenericLowering::LowerJSStoreProperty(Node* node) { |
332 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 320 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
333 const StorePropertyParameters& p = StorePropertyParametersOf(node->op()); | 321 const StorePropertyParameters& p = StorePropertyParametersOf(node->op()); |
334 LanguageMode language_mode = p.language_mode(); | 322 LanguageMode language_mode = p.language_mode(); |
335 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( | 323 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( |
336 isolate(), language_mode, UNINITIALIZED); | 324 isolate(), language_mode, UNINITIALIZED); |
337 if (FLAG_vector_stores) { | 325 if (FLAG_vector_stores) { |
(...skipping 20 matching lines...) Expand all Loading... | |
358 node->RemoveInput(3); | 346 node->RemoveInput(3); |
359 } | 347 } |
360 ReplaceWithStubCall(node, callable, | 348 ReplaceWithStubCall(node, callable, |
361 CallDescriptor::kPatchableCallSite | flags); | 349 CallDescriptor::kPatchableCallSite | flags); |
362 } | 350 } |
363 | 351 |
364 | 352 |
365 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { | 353 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { |
366 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 354 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
367 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); | 355 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); |
368 if (p.slot_index() >= 0) { | 356 Callable callable = CodeFactory::StoreICInOptimizedCode( |
369 Callable callable = | 357 isolate(), p.language_mode(), UNINITIALIZED); |
370 CodeFactory::StoreGlobalViaContext(isolate(), 0, p.language_mode()); | 358 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
Benedikt Meurer
2015/10/22 05:03:52
Insert the global object here, loading it from the
Igor Sheludko
2015/10/22 08:49:52
Done.
| |
371 Node* script_context = node->InputAt(0); | 359 if (FLAG_vector_stores) { |
372 Node* value = node->InputAt(2); | 360 DCHECK(p.feedback().index() != -1); |
373 node->ReplaceInput(0, jsgraph()->Int32Constant(p.slot_index())); | 361 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); |
374 node->ReplaceInput(1, value); | 362 } else { |
375 node->ReplaceInput(2, script_context); // Set new context... | |
376 node->RemoveInput(3); | 363 node->RemoveInput(3); |
377 node->RemoveInput(3); // ...instead of old one. | |
378 ReplaceWithStubCall(node, callable, flags); | |
379 | |
380 } else { | |
381 Callable callable = CodeFactory::StoreICInOptimizedCode( | |
382 isolate(), p.language_mode(), UNINITIALIZED); | |
383 node->RemoveInput(0); // script context | |
384 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | |
385 if (FLAG_vector_stores) { | |
386 DCHECK(p.feedback().index() != -1); | |
387 node->InsertInput(zone(), 3, | |
388 jsgraph()->SmiConstant(p.feedback().index())); | |
389 } else { | |
390 node->RemoveInput(3); | |
391 } | |
392 ReplaceWithStubCall(node, callable, | |
393 CallDescriptor::kPatchableCallSite | flags); | |
394 } | 364 } |
365 ReplaceWithStubCall(node, callable, | |
366 CallDescriptor::kPatchableCallSite | flags); | |
395 } | 367 } |
396 | 368 |
397 | 369 |
398 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { | 370 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { |
399 LanguageMode language_mode = OpParameter<LanguageMode>(node); | 371 LanguageMode language_mode = OpParameter<LanguageMode>(node); |
400 ReplaceWithRuntimeCall(node, is_strict(language_mode) | 372 ReplaceWithRuntimeCall(node, is_strict(language_mode) |
401 ? Runtime::kDeleteProperty_Strict | 373 ? Runtime::kDeleteProperty_Strict |
402 : Runtime::kDeleteProperty_Sloppy); | 374 : Runtime::kDeleteProperty_Sloppy); |
403 } | 375 } |
404 | 376 |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
850 } | 822 } |
851 | 823 |
852 | 824 |
853 MachineOperatorBuilder* JSGenericLowering::machine() const { | 825 MachineOperatorBuilder* JSGenericLowering::machine() const { |
854 return jsgraph()->machine(); | 826 return jsgraph()->machine(); |
855 } | 827 } |
856 | 828 |
857 } // namespace compiler | 829 } // namespace compiler |
858 } // namespace internal | 830 } // namespace internal |
859 } // namespace v8 | 831 } // namespace v8 |
OLD | NEW |