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

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

Issue 1480003002: [runtime] Replace global object link with native context link in all contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add patch from Orion for interpreter cementation test. Disable obsolete/invalid tests. Created 5 years 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/js-typed-lowering.h ('k') | src/compiler/opcodes.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/compilation-dependencies.h" 6 #include "src/compilation-dependencies.h"
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 } 1251 }
1252 node->RemoveInput(2); 1252 node->RemoveInput(2);
1253 node->ReplaceInput(2, effect); 1253 node->ReplaceInput(2, effect);
1254 NodeProperties::ChangeOp( 1254 NodeProperties::ChangeOp(
1255 node, 1255 node,
1256 simplified()->StoreField(AccessBuilder::ForContextSlot(access.index()))); 1256 simplified()->StoreField(AccessBuilder::ForContextSlot(access.index())));
1257 return Changed(node); 1257 return Changed(node);
1258 } 1258 }
1259 1259
1260 1260
1261 Reduction JSTypedLowering::ReduceJSLoadNativeContext(Node* node) {
1262 DCHECK_EQ(IrOpcode::kJSLoadNativeContext, node->opcode());
1263 Node* const effect = NodeProperties::GetEffectInput(node);
1264 Node* const control = graph()->start();
1265 node->ReplaceInput(1, effect);
1266 node->ReplaceInput(2, control);
1267 NodeProperties::ChangeOp(
1268 node,
1269 simplified()->LoadField(AccessBuilder::ForJSGlobalObjectNativeContext()));
1270 return Changed(node);
1271 }
1272
1273
1274 Reduction JSTypedLowering::ReduceJSConvertReceiver(Node* node) { 1261 Reduction JSTypedLowering::ReduceJSConvertReceiver(Node* node) {
1275 DCHECK_EQ(IrOpcode::kJSConvertReceiver, node->opcode()); 1262 DCHECK_EQ(IrOpcode::kJSConvertReceiver, node->opcode());
1276 ConvertReceiverMode mode = ConvertReceiverModeOf(node->op()); 1263 ConvertReceiverMode mode = ConvertReceiverModeOf(node->op());
1277 Node* receiver = NodeProperties::GetValueInput(node, 0); 1264 Node* receiver = NodeProperties::GetValueInput(node, 0);
1278 Type* receiver_type = NodeProperties::GetType(receiver); 1265 Type* receiver_type = NodeProperties::GetType(receiver);
1279 Node* context = NodeProperties::GetContextInput(node); 1266 Node* context = NodeProperties::GetContextInput(node);
1280 Type* context_type = NodeProperties::GetType(context); 1267 Type* context_type = NodeProperties::GetType(context);
1281 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); 1268 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0);
1282 Node* effect = NodeProperties::GetEffectInput(node); 1269 Node* effect = NodeProperties::GetEffectInput(node);
1283 Node* control = NodeProperties::GetControlInput(node); 1270 Node* control = NodeProperties::GetControlInput(node);
1284 if (!receiver_type->Is(Type::Receiver())) { 1271 if (!receiver_type->Is(Type::Receiver())) {
1285 if (receiver_type->Is(Type::NullOrUndefined()) || 1272 if (receiver_type->Is(Type::NullOrUndefined()) ||
1286 mode == ConvertReceiverMode::kNullOrUndefined) { 1273 mode == ConvertReceiverMode::kNullOrUndefined) {
1287 if (context_type->IsConstant()) { 1274 if (context_type->IsConstant()) {
1288 Handle<JSObject> global_proxy( 1275 Handle<JSObject> global_proxy(
1289 Handle<Context>::cast(context_type->AsConstant()->Value()) 1276 Handle<Context>::cast(context_type->AsConstant()->Value())
1290 ->global_proxy(), 1277 ->global_proxy(),
1291 isolate()); 1278 isolate());
1292 receiver = jsgraph()->Constant(global_proxy); 1279 receiver = jsgraph()->Constant(global_proxy);
1293 } else { 1280 } else {
1294 Node* global_object = effect = graph()->NewNode( 1281 Node* native_context = effect = graph()->NewNode(
1295 javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true), 1282 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
1296 context, context, effect); 1283 context, context, effect);
1297 receiver = effect = 1284 receiver = effect = graph()->NewNode(
1298 graph()->NewNode(simplified()->LoadField( 1285 javascript()->LoadContext(0, Context::GLOBAL_PROXY_INDEX, true),
1299 AccessBuilder::ForJSGlobalObjectGlobalProxy()), 1286 native_context, native_context, effect);
1300 global_object, effect, control);
1301 } 1287 }
1302 } else if (!receiver_type->Maybe(Type::NullOrUndefined()) || 1288 } else if (!receiver_type->Maybe(Type::NullOrUndefined()) ||
1303 mode == ConvertReceiverMode::kNotNullOrUndefined) { 1289 mode == ConvertReceiverMode::kNotNullOrUndefined) {
1304 receiver = effect = 1290 receiver = effect =
1305 graph()->NewNode(javascript()->ToObject(), receiver, context, 1291 graph()->NewNode(javascript()->ToObject(), receiver, context,
1306 frame_state, effect, control); 1292 frame_state, effect, control);
1307 } else { 1293 } else {
1308 // Check {receiver} for undefined. 1294 // Check {receiver} for undefined.
1309 Node* check0 = 1295 Node* check0 =
1310 graph()->NewNode(simplified()->ReferenceEqual(receiver_type), 1296 graph()->NewNode(simplified()->ReferenceEqual(receiver_type),
(...skipping 28 matching lines...) Expand all
1339 Node* eglobal = effect; 1325 Node* eglobal = effect;
1340 Node* rglobal; 1326 Node* rglobal;
1341 { 1327 {
1342 if (context_type->IsConstant()) { 1328 if (context_type->IsConstant()) {
1343 Handle<JSObject> global_proxy( 1329 Handle<JSObject> global_proxy(
1344 Handle<Context>::cast(context_type->AsConstant()->Value()) 1330 Handle<Context>::cast(context_type->AsConstant()->Value())
1345 ->global_proxy(), 1331 ->global_proxy(),
1346 isolate()); 1332 isolate());
1347 rglobal = jsgraph()->Constant(global_proxy); 1333 rglobal = jsgraph()->Constant(global_proxy);
1348 } else { 1334 } else {
1349 Node* global_object = eglobal = graph()->NewNode( 1335 Node* native_context = eglobal = graph()->NewNode(
1350 javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true), 1336 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
1351 context, context, eglobal); 1337 context, context, eglobal);
1352 rglobal = eglobal = graph()->NewNode( 1338 rglobal = eglobal = graph()->NewNode(
1353 simplified()->LoadField( 1339 javascript()->LoadContext(0, Context::GLOBAL_PROXY_INDEX, true),
1354 AccessBuilder::ForJSGlobalObjectGlobalProxy()), 1340 native_context, native_context, eglobal);
1355 global_object, eglobal, if_global);
1356 } 1341 }
1357 } 1342 }
1358 1343
1359 control = graph()->NewNode(common()->Merge(2), if_convert, if_global); 1344 control = graph()->NewNode(common()->Merge(2), if_convert, if_global);
1360 effect = 1345 effect =
1361 graph()->NewNode(common()->EffectPhi(2), econvert, eglobal, control); 1346 graph()->NewNode(common()->EffectPhi(2), econvert, eglobal, control);
1362 receiver = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), rconvert, 1347 receiver = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), rconvert,
1363 rglobal, control); 1348 rglobal, control);
1364 } 1349 }
1365 } 1350 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 // there conceptually is an arguments adaptor frame in the call chain. 1488 // there conceptually is an arguments adaptor frame in the call chain.
1504 Node* const args_state = GetArgumentsFrameState(frame_state); 1489 Node* const args_state = GetArgumentsFrameState(frame_state);
1505 FrameStateInfo args_state_info = OpParameter<FrameStateInfo>(args_state); 1490 FrameStateInfo args_state_info = OpParameter<FrameStateInfo>(args_state);
1506 // Prepare element backing store to be used by arguments object. 1491 // Prepare element backing store to be used by arguments object.
1507 bool has_aliased_arguments = false; 1492 bool has_aliased_arguments = false;
1508 Node* const elements = AllocateAliasedArguments( 1493 Node* const elements = AllocateAliasedArguments(
1509 effect, control, args_state, context, shared, &has_aliased_arguments); 1494 effect, control, args_state, context, shared, &has_aliased_arguments);
1510 Node* allocate_effect = 1495 Node* allocate_effect =
1511 elements->op()->EffectOutputCount() > 0 ? elements : effect; 1496 elements->op()->EffectOutputCount() > 0 ? elements : effect;
1512 // Load the arguments object map from the current native context. 1497 // Load the arguments object map from the current native context.
1513 Node* const load_global_object = graph()->NewNode( 1498 Node* const load_native_context = graph()->NewNode(
1514 simplified()->LoadField( 1499 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
1515 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)), 1500 context, context, effect);
1516 context, effect, control);
1517 Node* const load_native_context =
1518 graph()->NewNode(simplified()->LoadField(
1519 AccessBuilder::ForJSGlobalObjectNativeContext()),
1520 load_global_object, effect, control);
1521 Node* const load_arguments_map = graph()->NewNode( 1501 Node* const load_arguments_map = graph()->NewNode(
1522 simplified()->LoadField(AccessBuilder::ForContextSlot( 1502 simplified()->LoadField(AccessBuilder::ForContextSlot(
1523 has_aliased_arguments ? Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX 1503 has_aliased_arguments ? Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX
1524 : Context::SLOPPY_ARGUMENTS_MAP_INDEX)), 1504 : Context::SLOPPY_ARGUMENTS_MAP_INDEX)),
1525 load_native_context, effect, control); 1505 load_native_context, effect, control);
1526 // Actually allocate and initialize the arguments object. 1506 // Actually allocate and initialize the arguments object.
1527 AllocationBuilder a(jsgraph(), allocate_effect, control); 1507 AllocationBuilder a(jsgraph(), allocate_effect, control);
1528 Node* properties = jsgraph()->EmptyFixedArrayConstant(); 1508 Node* properties = jsgraph()->EmptyFixedArrayConstant();
1529 int length = args_state_info.parameter_count() - 1; // Minus receiver. 1509 int length = args_state_info.parameter_count() - 1; // Minus receiver.
1530 STATIC_ASSERT(Heap::kSloppyArgumentsObjectSize == 5 * kPointerSize); 1510 STATIC_ASSERT(Heap::kSloppyArgumentsObjectSize == 5 * kPointerSize);
(...skipping 17 matching lines...) Expand all
1548 Node* const context = NodeProperties::GetContextInput(node); 1528 Node* const context = NodeProperties::GetContextInput(node);
1549 // Choose the correct frame state and frame state info depending on whether 1529 // Choose the correct frame state and frame state info depending on whether
1550 // there conceptually is an arguments adaptor frame in the call chain. 1530 // there conceptually is an arguments adaptor frame in the call chain.
1551 Node* const args_state = GetArgumentsFrameState(frame_state); 1531 Node* const args_state = GetArgumentsFrameState(frame_state);
1552 FrameStateInfo args_state_info = OpParameter<FrameStateInfo>(args_state); 1532 FrameStateInfo args_state_info = OpParameter<FrameStateInfo>(args_state);
1553 // Prepare element backing store to be used by arguments object. 1533 // Prepare element backing store to be used by arguments object.
1554 Node* const elements = AllocateArguments(effect, control, args_state); 1534 Node* const elements = AllocateArguments(effect, control, args_state);
1555 Node* allocate_effect = 1535 Node* allocate_effect =
1556 elements->op()->EffectOutputCount() > 0 ? elements : effect; 1536 elements->op()->EffectOutputCount() > 0 ? elements : effect;
1557 // Load the arguments object map from the current native context. 1537 // Load the arguments object map from the current native context.
1558 Node* const load_global_object = graph()->NewNode( 1538 Node* const load_native_context = graph()->NewNode(
1559 simplified()->LoadField( 1539 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
1560 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)), 1540 context, context, effect);
1561 context, effect, control);
1562 Node* const load_native_context =
1563 graph()->NewNode(simplified()->LoadField(
1564 AccessBuilder::ForJSGlobalObjectNativeContext()),
1565 load_global_object, effect, control);
1566 Node* const load_arguments_map = graph()->NewNode( 1541 Node* const load_arguments_map = graph()->NewNode(
1567 simplified()->LoadField( 1542 simplified()->LoadField(
1568 AccessBuilder::ForContextSlot(Context::STRICT_ARGUMENTS_MAP_INDEX)), 1543 AccessBuilder::ForContextSlot(Context::STRICT_ARGUMENTS_MAP_INDEX)),
1569 load_native_context, effect, control); 1544 load_native_context, effect, control);
1570 // Actually allocate and initialize the arguments object. 1545 // Actually allocate and initialize the arguments object.
1571 AllocationBuilder a(jsgraph(), allocate_effect, control); 1546 AllocationBuilder a(jsgraph(), allocate_effect, control);
1572 Node* properties = jsgraph()->EmptyFixedArrayConstant(); 1547 Node* properties = jsgraph()->EmptyFixedArrayConstant();
1573 int length = args_state_info.parameter_count() - 1; // Minus receiver. 1548 int length = args_state_info.parameter_count() - 1; // Minus receiver.
1574 STATIC_ASSERT(Heap::kStrictArgumentsObjectSize == 4 * kPointerSize); 1549 STATIC_ASSERT(Heap::kStrictArgumentsObjectSize == 4 * kPointerSize);
1575 a.Allocate(Heap::kStrictArgumentsObjectSize); 1550 a.Allocate(Heap::kStrictArgumentsObjectSize);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 Node* js_array_map; 1585 Node* js_array_map;
1611 if (target_type->IsConstant()) { 1586 if (target_type->IsConstant()) {
1612 Handle<JSFunction> target_function = 1587 Handle<JSFunction> target_function =
1613 Handle<JSFunction>::cast(target_type->AsConstant()->Value()); 1588 Handle<JSFunction>::cast(target_type->AsConstant()->Value());
1614 Handle<FixedArray> js_array_maps( 1589 Handle<FixedArray> js_array_maps(
1615 FixedArray::cast(target_function->native_context()->js_array_maps()), 1590 FixedArray::cast(target_function->native_context()->js_array_maps()),
1616 isolate()); 1591 isolate());
1617 js_array_map = jsgraph()->Constant( 1592 js_array_map = jsgraph()->Constant(
1618 handle(js_array_maps->get(elements_kind), isolate())); 1593 handle(js_array_maps->get(elements_kind), isolate()));
1619 } else { 1594 } else {
1620 Node* global_object = effect = graph()->NewNode( 1595 Node* native_context = effect = graph()->NewNode(
1621 javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true), 1596 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
1622 context, context, effect); 1597 context, context, effect);
1623 Node* native_context = effect =
1624 graph()->NewNode(simplified()->LoadField(
1625 AccessBuilder::ForJSGlobalObjectNativeContext()),
1626 global_object, effect, control);
1627 Node* js_array_maps = effect = graph()->NewNode( 1598 Node* js_array_maps = effect = graph()->NewNode(
1628 javascript()->LoadContext(0, Context::JS_ARRAY_MAPS_INDEX, true), 1599 javascript()->LoadContext(0, Context::JS_ARRAY_MAPS_INDEX, true),
1629 native_context, native_context, effect); 1600 native_context, native_context, effect);
1630 js_array_map = effect = 1601 js_array_map = effect =
1631 graph()->NewNode(simplified()->LoadField( 1602 graph()->NewNode(simplified()->LoadField(
1632 AccessBuilder::ForFixedArraySlot(elements_kind)), 1603 AccessBuilder::ForFixedArraySlot(elements_kind)),
1633 js_array_maps, effect, control); 1604 js_array_maps, effect, control);
1634 } 1605 }
1635 1606
1636 // Setup elements and properties. 1607 // Setup elements and properties.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 1806
1836 1807
1837 Reduction JSTypedLowering::ReduceJSCreateFunctionContext(Node* node) { 1808 Reduction JSTypedLowering::ReduceJSCreateFunctionContext(Node* node) {
1838 DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, node->opcode()); 1809 DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, node->opcode());
1839 int slot_count = OpParameter<int>(node->op()); 1810 int slot_count = OpParameter<int>(node->op());
1840 Node* const closure = NodeProperties::GetValueInput(node, 0); 1811 Node* const closure = NodeProperties::GetValueInput(node, 0);
1841 1812
1842 // Use inline allocation for function contexts up to a size limit. 1813 // Use inline allocation for function contexts up to a size limit.
1843 if (slot_count < kFunctionContextAllocationLimit) { 1814 if (slot_count < kFunctionContextAllocationLimit) {
1844 // JSCreateFunctionContext[slot_count < limit]](fun) 1815 // JSCreateFunctionContext[slot_count < limit]](fun)
1845 Node* const effect = NodeProperties::GetEffectInput(node); 1816 Node* effect = NodeProperties::GetEffectInput(node);
1846 Node* const control = NodeProperties::GetControlInput(node); 1817 Node* control = NodeProperties::GetControlInput(node);
1847 Node* const context = NodeProperties::GetContextInput(node); 1818 Node* context = NodeProperties::GetContextInput(node);
1848 Node* const extension = jsgraph()->ZeroConstant(); 1819 Node* extension = jsgraph()->ZeroConstant();
1849 Node* const load = graph()->NewNode( 1820 Node* native_context = effect = graph()->NewNode(
1850 simplified()->LoadField( 1821 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
1851 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)), 1822 context, context, effect);
1852 context, effect, control);
1853 AllocationBuilder a(jsgraph(), effect, control); 1823 AllocationBuilder a(jsgraph(), effect, control);
1854 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered. 1824 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered.
1855 int context_length = slot_count + Context::MIN_CONTEXT_SLOTS; 1825 int context_length = slot_count + Context::MIN_CONTEXT_SLOTS;
1856 a.AllocateArray(context_length, factory()->function_context_map()); 1826 a.AllocateArray(context_length, factory()->function_context_map());
1857 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure); 1827 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure);
1858 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); 1828 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context);
1859 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), extension); 1829 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), extension);
1860 a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load); 1830 a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX),
1831 native_context);
1861 for (int i = Context::MIN_CONTEXT_SLOTS; i < context_length; ++i) { 1832 for (int i = Context::MIN_CONTEXT_SLOTS; i < context_length; ++i) {
1862 a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->UndefinedConstant()); 1833 a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->UndefinedConstant());
1863 } 1834 }
1864 RelaxControls(node); 1835 RelaxControls(node);
1865 a.FinishAndChange(node); 1836 a.FinishAndChange(node);
1866 return Changed(node); 1837 return Changed(node);
1867 } 1838 }
1868 1839
1869 // Use the FastNewContextStub only for function contexts up maximum size. 1840 // Use the FastNewContextStub only for function contexts up maximum size.
1870 if (slot_count <= FastNewContextStub::kMaximumSlots) { 1841 if (slot_count <= FastNewContextStub::kMaximumSlots) {
(...skipping 13 matching lines...) Expand all
1884 } 1855 }
1885 1856
1886 1857
1887 Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) { 1858 Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) {
1888 DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode()); 1859 DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode());
1889 Node* object = NodeProperties::GetValueInput(node, 0); 1860 Node* object = NodeProperties::GetValueInput(node, 0);
1890 Node* closure = NodeProperties::GetValueInput(node, 1); 1861 Node* closure = NodeProperties::GetValueInput(node, 1);
1891 Node* effect = NodeProperties::GetEffectInput(node); 1862 Node* effect = NodeProperties::GetEffectInput(node);
1892 Node* control = NodeProperties::GetControlInput(node); 1863 Node* control = NodeProperties::GetControlInput(node);
1893 Node* context = NodeProperties::GetContextInput(node); 1864 Node* context = NodeProperties::GetContextInput(node);
1894 Node* global = effect = graph()->NewNode( 1865 Node* native_context = effect = graph()->NewNode(
1895 simplified()->LoadField( 1866 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
1896 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)), 1867 context, context, effect);
1897 context, effect, control);
1898 AllocationBuilder a(jsgraph(), effect, control); 1868 AllocationBuilder a(jsgraph(), effect, control);
1899 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered. 1869 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered.
1900 a.AllocateArray(Context::MIN_CONTEXT_SLOTS, factory()->with_context_map()); 1870 a.AllocateArray(Context::MIN_CONTEXT_SLOTS, factory()->with_context_map());
1901 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure); 1871 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure);
1902 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); 1872 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context);
1903 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), object); 1873 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), object);
1904 a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), global); 1874 a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX),
1875 native_context);
1905 RelaxControls(node); 1876 RelaxControls(node);
1906 a.FinishAndChange(node); 1877 a.FinishAndChange(node);
1907 return Changed(node); 1878 return Changed(node);
1908 } 1879 }
1909 1880
1910 1881
1911 Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) { 1882 Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) {
1912 DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode()); 1883 DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode());
1913 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node); 1884 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node);
1914 int context_length = scope_info->ContextLength(); 1885 int context_length = scope_info->ContextLength();
1915 Node* const closure = NodeProperties::GetValueInput(node, 0); 1886 Node* const closure = NodeProperties::GetValueInput(node, 0);
1916 1887
1917 // Use inline allocation for block contexts up to a size limit. 1888 // Use inline allocation for block contexts up to a size limit.
1918 if (context_length < kBlockContextAllocationLimit) { 1889 if (context_length < kBlockContextAllocationLimit) {
1919 // JSCreateBlockContext[scope[length < limit]](fun) 1890 // JSCreateBlockContext[scope[length < limit]](fun)
1920 Node* const effect = NodeProperties::GetEffectInput(node); 1891 Node* effect = NodeProperties::GetEffectInput(node);
1921 Node* const control = NodeProperties::GetControlInput(node); 1892 Node* control = NodeProperties::GetControlInput(node);
1922 Node* const context = NodeProperties::GetContextInput(node); 1893 Node* context = NodeProperties::GetContextInput(node);
1923 Node* const extension = jsgraph()->Constant(scope_info); 1894 Node* extension = jsgraph()->Constant(scope_info);
1924 Node* const load = graph()->NewNode( 1895 Node* native_context = effect = graph()->NewNode(
1925 simplified()->LoadField( 1896 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
1926 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)), 1897 context, context, effect);
1927 context, effect, control);
1928 AllocationBuilder a(jsgraph(), effect, control); 1898 AllocationBuilder a(jsgraph(), effect, control);
1929 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered. 1899 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered.
1930 a.AllocateArray(context_length, factory()->block_context_map()); 1900 a.AllocateArray(context_length, factory()->block_context_map());
1931 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure); 1901 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure);
1932 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); 1902 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context);
1933 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), extension); 1903 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), extension);
1934 a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load); 1904 a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX),
1905 native_context);
1935 for (int i = Context::MIN_CONTEXT_SLOTS; i < context_length; ++i) { 1906 for (int i = Context::MIN_CONTEXT_SLOTS; i < context_length; ++i) {
1936 a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->TheHoleConstant()); 1907 a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->TheHoleConstant());
1937 } 1908 }
1938 RelaxControls(node); 1909 RelaxControls(node);
1939 a.FinishAndChange(node); 1910 a.FinishAndChange(node);
1940 return Changed(node); 1911 return Changed(node);
1941 } 1912 }
1942 1913
1943 return NoChange(); 1914 return NoChange();
1944 } 1915 }
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
2414 case IrOpcode::kJSLoadProperty: 2385 case IrOpcode::kJSLoadProperty:
2415 return ReduceJSLoadProperty(node); 2386 return ReduceJSLoadProperty(node);
2416 case IrOpcode::kJSStoreProperty: 2387 case IrOpcode::kJSStoreProperty:
2417 return ReduceJSStoreProperty(node); 2388 return ReduceJSStoreProperty(node);
2418 case IrOpcode::kJSInstanceOf: 2389 case IrOpcode::kJSInstanceOf:
2419 return ReduceJSInstanceOf(node); 2390 return ReduceJSInstanceOf(node);
2420 case IrOpcode::kJSLoadContext: 2391 case IrOpcode::kJSLoadContext:
2421 return ReduceJSLoadContext(node); 2392 return ReduceJSLoadContext(node);
2422 case IrOpcode::kJSStoreContext: 2393 case IrOpcode::kJSStoreContext:
2423 return ReduceJSStoreContext(node); 2394 return ReduceJSStoreContext(node);
2424 case IrOpcode::kJSLoadNativeContext:
2425 return ReduceJSLoadNativeContext(node);
2426 case IrOpcode::kJSConvertReceiver: 2395 case IrOpcode::kJSConvertReceiver:
2427 return ReduceJSConvertReceiver(node); 2396 return ReduceJSConvertReceiver(node);
2428 case IrOpcode::kJSCreate: 2397 case IrOpcode::kJSCreate:
2429 return ReduceJSCreate(node); 2398 return ReduceJSCreate(node);
2430 case IrOpcode::kJSCreateArguments: 2399 case IrOpcode::kJSCreateArguments:
2431 return ReduceJSCreateArguments(node); 2400 return ReduceJSCreateArguments(node);
2432 case IrOpcode::kJSCreateArray: 2401 case IrOpcode::kJSCreateArray:
2433 return ReduceJSCreateArray(node); 2402 return ReduceJSCreateArray(node);
2434 case IrOpcode::kJSCreateClosure: 2403 case IrOpcode::kJSCreateClosure:
2435 return ReduceJSCreateClosure(node); 2404 return ReduceJSCreateClosure(node);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 } 2568 }
2600 2569
2601 2570
2602 CompilationDependencies* JSTypedLowering::dependencies() const { 2571 CompilationDependencies* JSTypedLowering::dependencies() const {
2603 return dependencies_; 2572 return dependencies_;
2604 } 2573 }
2605 2574
2606 } // namespace compiler 2575 } // namespace compiler
2607 } // namespace internal 2576 } // namespace internal
2608 } // namespace v8 2577 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698