OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 __ Move(dst, | 1302 __ Move(dst, |
1303 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED)); | 1303 isolate()->factory()->NewNumber(src.ToFloat32(), TENURED)); |
1304 break; | 1304 break; |
1305 case Constant::kFloat64: | 1305 case Constant::kFloat64: |
1306 __ Move(dst, | 1306 __ Move(dst, |
1307 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); | 1307 isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); |
1308 break; | 1308 break; |
1309 case Constant::kExternalReference: | 1309 case Constant::kExternalReference: |
1310 __ Move(dst, src.ToExternalReference()); | 1310 __ Move(dst, src.ToExternalReference()); |
1311 break; | 1311 break; |
1312 case Constant::kHeapObject: | 1312 case Constant::kHeapObject: { |
1313 __ Move(dst, src.ToHeapObject()); | 1313 Handle<HeapObject> src_object = src.ToHeapObject(); |
| 1314 if (info()->IsOptimizing() && |
| 1315 src_object.is_identical_to(info()->context())) { |
| 1316 // Loading the context from the frame is way cheaper than |
| 1317 // materializing the actual context heap object address. |
| 1318 __ movp(dst, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 1319 } else { |
| 1320 __ Move(dst, src_object); |
| 1321 } |
1314 break; | 1322 break; |
| 1323 } |
1315 case Constant::kRpoNumber: | 1324 case Constant::kRpoNumber: |
1316 UNREACHABLE(); // TODO(dcarney): load of labels on x64. | 1325 UNREACHABLE(); // TODO(dcarney): load of labels on x64. |
1317 break; | 1326 break; |
1318 } | 1327 } |
1319 if (destination->IsStackSlot()) { | 1328 if (destination->IsStackSlot()) { |
1320 __ movq(g.ToOperand(destination), kScratchRegister); | 1329 __ movq(g.ToOperand(destination), kScratchRegister); |
1321 } | 1330 } |
1322 } else if (src.type() == Constant::kFloat32) { | 1331 } else if (src.type() == Constant::kFloat32) { |
1323 // TODO(turbofan): Can we do better here? | 1332 // TODO(turbofan): Can we do better here? |
1324 uint32_t src_const = bit_cast<uint32_t>(src.ToFloat32()); | 1333 uint32_t src_const = bit_cast<uint32_t>(src.ToFloat32()); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 } | 1444 } |
1436 } | 1445 } |
1437 MarkLazyDeoptSite(); | 1446 MarkLazyDeoptSite(); |
1438 } | 1447 } |
1439 | 1448 |
1440 #undef __ | 1449 #undef __ |
1441 | 1450 |
1442 } // namespace internal | 1451 } // namespace internal |
1443 } // namespace compiler | 1452 } // namespace compiler |
1444 } // namespace v8 | 1453 } // namespace v8 |
OLD | NEW |