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/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 #include "src/compiler/code-generator-impl.h" | 6 #include "src/compiler/code-generator-impl.h" |
7 #include "src/compiler/gap-resolver.h" | 7 #include "src/compiler/gap-resolver.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/mips/macro-assembler-mips.h" | 9 #include "src/mips/macro-assembler-mips.h" |
10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 break; | 1197 break; |
1198 case Constant::kInt64: | 1198 case Constant::kInt64: |
1199 __ li(dst, Operand(src.ToInt64())); | 1199 __ li(dst, Operand(src.ToInt64())); |
1200 break; | 1200 break; |
1201 case Constant::kFloat64: | 1201 case Constant::kFloat64: |
1202 __ li(dst, isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); | 1202 __ li(dst, isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); |
1203 break; | 1203 break; |
1204 case Constant::kExternalReference: | 1204 case Constant::kExternalReference: |
1205 __ li(dst, Operand(src.ToExternalReference())); | 1205 __ li(dst, Operand(src.ToExternalReference())); |
1206 break; | 1206 break; |
1207 case Constant::kHeapObject: | 1207 case Constant::kHeapObject: { |
1208 __ li(dst, src.ToHeapObject()); | 1208 Handle<HeapObject> src_object = src.ToHeapObject(); |
| 1209 if (info()->IsOptimizing() && |
| 1210 src_object.is_identical_to(info()->context())) { |
| 1211 // Loading the context from the frame is way cheaper than |
| 1212 // materializing the actual context heap object address. |
| 1213 __ ld(dst, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1214 } else if (info()->IsOptimizing() && |
| 1215 src_object.is_identical_to(info()->closure())) { |
| 1216 // Loading the JSFunction from the frame is way cheaper than |
| 1217 // materializing the actual JSFunction heap object address. |
| 1218 __ ld(dst, |
| 1219 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1220 } else { |
| 1221 __ li(dst, src_object); |
| 1222 } |
1209 break; | 1223 break; |
| 1224 } |
1210 case Constant::kRpoNumber: | 1225 case Constant::kRpoNumber: |
1211 UNREACHABLE(); // TODO(titzer): loading RPO numbers on mips64. | 1226 UNREACHABLE(); // TODO(titzer): loading RPO numbers on mips64. |
1212 break; | 1227 break; |
1213 } | 1228 } |
1214 if (destination->IsStackSlot()) __ sd(dst, g.ToMemOperand(destination)); | 1229 if (destination->IsStackSlot()) __ sd(dst, g.ToMemOperand(destination)); |
1215 } else if (src.type() == Constant::kFloat32) { | 1230 } else if (src.type() == Constant::kFloat32) { |
1216 if (destination->IsDoubleStackSlot()) { | 1231 if (destination->IsDoubleStackSlot()) { |
1217 MemOperand dst = g.ToMemOperand(destination); | 1232 MemOperand dst = g.ToMemOperand(destination); |
1218 __ li(at, Operand(bit_cast<int32_t>(src.ToFloat32()))); | 1233 __ li(at, Operand(bit_cast<int32_t>(src.ToFloat32()))); |
1219 __ sw(at, dst); | 1234 __ sw(at, dst); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 } | 1370 } |
1356 } | 1371 } |
1357 MarkLazyDeoptSite(); | 1372 MarkLazyDeoptSite(); |
1358 } | 1373 } |
1359 | 1374 |
1360 #undef __ | 1375 #undef __ |
1361 | 1376 |
1362 } // namespace compiler | 1377 } // namespace compiler |
1363 } // namespace internal | 1378 } // namespace internal |
1364 } // namespace v8 | 1379 } // namespace v8 |
OLD | NEW |