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 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 break; | 1131 break; |
1132 case Constant::kInt64: | 1132 case Constant::kInt64: |
1133 UNREACHABLE(); | 1133 UNREACHABLE(); |
1134 break; | 1134 break; |
1135 case Constant::kFloat64: | 1135 case Constant::kFloat64: |
1136 __ li(dst, isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); | 1136 __ li(dst, isolate()->factory()->NewNumber(src.ToFloat64(), TENURED)); |
1137 break; | 1137 break; |
1138 case Constant::kExternalReference: | 1138 case Constant::kExternalReference: |
1139 __ li(dst, Operand(src.ToExternalReference())); | 1139 __ li(dst, Operand(src.ToExternalReference())); |
1140 break; | 1140 break; |
1141 case Constant::kHeapObject: | 1141 case Constant::kHeapObject: { |
1142 __ li(dst, src.ToHeapObject()); | 1142 Handle<HeapObject> src_object = src.ToHeapObject(); |
| 1143 if (info()->IsOptimizing() && |
| 1144 src_object.is_identical_to(info()->context())) { |
| 1145 // Loading the context from the frame is way cheaper than |
| 1146 // materializing the actual context heap object address. |
| 1147 __ lw(dst, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1148 } else if (info()->IsOptimizing() && |
| 1149 src_object.is_identical_to(info()->closure())) { |
| 1150 // Loading the JSFunction from the frame is way cheaper than |
| 1151 // materializing the actual JSFunction heap object address. |
| 1152 __ lw(dst, |
| 1153 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1154 } else { |
| 1155 __ li(dst, src_object); |
| 1156 } |
1143 break; | 1157 break; |
| 1158 } |
1144 case Constant::kRpoNumber: | 1159 case Constant::kRpoNumber: |
1145 UNREACHABLE(); // TODO(titzer): loading RPO numbers on mips. | 1160 UNREACHABLE(); // TODO(titzer): loading RPO numbers on mips. |
1146 break; | 1161 break; |
1147 } | 1162 } |
1148 if (destination->IsStackSlot()) __ sw(dst, g.ToMemOperand(destination)); | 1163 if (destination->IsStackSlot()) __ sw(dst, g.ToMemOperand(destination)); |
1149 } else if (src.type() == Constant::kFloat32) { | 1164 } else if (src.type() == Constant::kFloat32) { |
1150 if (destination->IsDoubleStackSlot()) { | 1165 if (destination->IsDoubleStackSlot()) { |
1151 MemOperand dst = g.ToMemOperand(destination); | 1166 MemOperand dst = g.ToMemOperand(destination); |
1152 __ li(at, Operand(bit_cast<int32_t>(src.ToFloat32()))); | 1167 __ li(at, Operand(bit_cast<int32_t>(src.ToFloat32()))); |
1153 __ sw(at, dst); | 1168 __ sw(at, dst); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 } | 1304 } |
1290 } | 1305 } |
1291 MarkLazyDeoptSite(); | 1306 MarkLazyDeoptSite(); |
1292 } | 1307 } |
1293 | 1308 |
1294 #undef __ | 1309 #undef __ |
1295 | 1310 |
1296 } // namespace compiler | 1311 } // namespace compiler |
1297 } // namespace internal | 1312 } // namespace internal |
1298 } // namespace v8 | 1313 } // namespace v8 |
OLD | NEW |