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 | 6 |
7 #include "src/arm64/macro-assembler-arm64.h" | 7 #include "src/arm64/macro-assembler-arm64.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 __ Ldr(temp, src); | 1119 __ Ldr(temp, src); |
1120 __ Str(temp, g.ToMemOperand(destination, masm())); | 1120 __ Str(temp, g.ToMemOperand(destination, masm())); |
1121 } | 1121 } |
1122 } else if (source->IsConstant()) { | 1122 } else if (source->IsConstant()) { |
1123 Constant src = g.ToConstant(ConstantOperand::cast(source)); | 1123 Constant src = g.ToConstant(ConstantOperand::cast(source)); |
1124 if (destination->IsRegister() || destination->IsStackSlot()) { | 1124 if (destination->IsRegister() || destination->IsStackSlot()) { |
1125 UseScratchRegisterScope scope(masm()); | 1125 UseScratchRegisterScope scope(masm()); |
1126 Register dst = destination->IsRegister() ? g.ToRegister(destination) | 1126 Register dst = destination->IsRegister() ? g.ToRegister(destination) |
1127 : scope.AcquireX(); | 1127 : scope.AcquireX(); |
1128 if (src.type() == Constant::kHeapObject) { | 1128 if (src.type() == Constant::kHeapObject) { |
1129 __ LoadObject(dst, src.ToHeapObject()); | 1129 Handle<HeapObject> src_object = src.ToHeapObject(); |
| 1130 if (info()->IsOptimizing() && |
| 1131 src_object.is_identical_to(info()->context())) { |
| 1132 // Loading the context from the frame is way cheaper than |
| 1133 // materializing the actual context heap object address. |
| 1134 __ Ldr(dst, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1135 } else if (info()->IsOptimizing() && |
| 1136 src_object.is_identical_to(info()->closure())) { |
| 1137 // Loading the JSFunction from the frame is way cheaper than |
| 1138 // materializing the actual JSFunction heap object address. |
| 1139 __ Ldr(dst, |
| 1140 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1141 } else { |
| 1142 __ LoadObject(dst, src_object); |
| 1143 } |
1130 } else { | 1144 } else { |
1131 __ Mov(dst, g.ToImmediate(source)); | 1145 __ Mov(dst, g.ToImmediate(source)); |
1132 } | 1146 } |
1133 if (destination->IsStackSlot()) { | 1147 if (destination->IsStackSlot()) { |
1134 __ Str(dst, g.ToMemOperand(destination, masm())); | 1148 __ Str(dst, g.ToMemOperand(destination, masm())); |
1135 } | 1149 } |
1136 } else if (src.type() == Constant::kFloat32) { | 1150 } else if (src.type() == Constant::kFloat32) { |
1137 if (destination->IsDoubleRegister()) { | 1151 if (destination->IsDoubleRegister()) { |
1138 FPRegister dst = g.ToDoubleRegister(destination).S(); | 1152 FPRegister dst = g.ToDoubleRegister(destination).S(); |
1139 __ Fmov(dst, src.ToFloat32()); | 1153 __ Fmov(dst, src.ToFloat32()); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 } | 1281 } |
1268 } | 1282 } |
1269 MarkLazyDeoptSite(); | 1283 MarkLazyDeoptSite(); |
1270 } | 1284 } |
1271 | 1285 |
1272 #undef __ | 1286 #undef __ |
1273 | 1287 |
1274 } // namespace compiler | 1288 } // namespace compiler |
1275 } // namespace internal | 1289 } // namespace internal |
1276 } // namespace v8 | 1290 } // namespace v8 |
OLD | NEW |