OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/bailout-reason.h" | 7 #include "src/bailout-reason.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/field-index.h" | 9 #include "src/field-index.h" |
10 #include "src/hydrogen.h" | 10 #include "src/hydrogen.h" |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 return DoGenerateCode(this); | 1306 return DoGenerateCode(this); |
1307 } | 1307 } |
1308 | 1308 |
1309 | 1309 |
1310 template <> | 1310 template <> |
1311 HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() { | 1311 HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() { |
1312 StoreGlobalStub* stub = casted_stub(); | 1312 StoreGlobalStub* stub = casted_stub(); |
1313 Handle<Object> placeholer_value(Smi::FromInt(0), isolate()); | 1313 Handle<Object> placeholer_value(Smi::FromInt(0), isolate()); |
1314 Handle<PropertyCell> placeholder_cell = | 1314 Handle<PropertyCell> placeholder_cell = |
1315 isolate()->factory()->NewPropertyCell(placeholer_value); | 1315 isolate()->factory()->NewPropertyCell(placeholer_value); |
1316 | |
1317 HParameter* value = GetParameter(StoreDescriptor::kValueIndex); | 1316 HParameter* value = GetParameter(StoreDescriptor::kValueIndex); |
1318 | |
1319 if (stub->check_global()) { | 1317 if (stub->check_global()) { |
1320 // Check that the map of the global has not changed: use a placeholder map | 1318 // Check that the map of the global has not changed: use a placeholder map |
1321 // that will be replaced later with the global object's map. | 1319 // that will be replaced later with the global object's map. |
| 1320 HParameter* proxy = GetParameter(StoreDescriptor::kReceiverIndex); |
| 1321 HValue* proxy_map = |
| 1322 Add<HLoadNamedField>(proxy, nullptr, HObjectAccess::ForMap()); |
| 1323 HValue* global = |
| 1324 Add<HLoadNamedField>(proxy_map, nullptr, HObjectAccess::ForPrototype()); |
1322 Handle<Map> placeholder_map = isolate()->factory()->meta_map(); | 1325 Handle<Map> placeholder_map = isolate()->factory()->meta_map(); |
1323 HValue* global = Add<HConstant>( | 1326 HValue* cell = Add<HConstant>(Map::WeakCellForMap(placeholder_map)); |
1324 StoreGlobalStub::global_placeholder(isolate())); | 1327 HValue* expected_map = |
1325 Add<HCheckMaps>(global, placeholder_map); | 1328 Add<HLoadNamedField>(cell, nullptr, HObjectAccess::ForWeakCellValue()); |
| 1329 HValue* map = |
| 1330 Add<HLoadNamedField>(global, nullptr, HObjectAccess::ForMap()); |
| 1331 IfBuilder map_check(this); |
| 1332 map_check.IfNot<HCompareObjectEqAndBranch>(expected_map, map); |
| 1333 map_check.ThenDeopt("Unknown map"); |
| 1334 map_check.End(); |
1326 } | 1335 } |
1327 | 1336 |
1328 HValue* cell = Add<HConstant>(placeholder_cell); | 1337 HValue* cell = Add<HConstant>(placeholder_cell); |
1329 HObjectAccess access(HObjectAccess::ForCellPayload(isolate())); | 1338 HObjectAccess access(HObjectAccess::ForCellPayload(isolate())); |
1330 HValue* cell_contents = Add<HLoadNamedField>(cell, nullptr, access); | 1339 HValue* cell_contents = Add<HLoadNamedField>(cell, nullptr, access); |
1331 | 1340 |
1332 if (stub->is_constant()) { | 1341 if (stub->is_constant()) { |
1333 IfBuilder builder(this); | 1342 IfBuilder builder(this); |
1334 builder.If<HCompareObjectEqAndBranch>(cell_contents, value); | 1343 builder.If<HCompareObjectEqAndBranch>(cell_contents, value); |
1335 builder.Then(); | 1344 builder.Then(); |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 // megamorphic case is handled as part of the default stub. | 2225 // megamorphic case is handled as part of the default stub. |
2217 DCHECK(!FLAG_vector_ics); | 2226 DCHECK(!FLAG_vector_ics); |
2218 | 2227 |
2219 // Probe the stub cache. | 2228 // Probe the stub cache. |
2220 Add<HTailCallThroughMegamorphicCache>(receiver, name); | 2229 Add<HTailCallThroughMegamorphicCache>(receiver, name); |
2221 | 2230 |
2222 // We never continue. | 2231 // We never continue. |
2223 return graph()->GetConstant0(); | 2232 return graph()->GetConstant0(); |
2224 } | 2233 } |
2225 } } // namespace v8::internal | 2234 } } // namespace v8::internal |
OLD | NEW |