| 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/ia32/assembler-ia32.h" | 10 #include "src/ia32/assembler-ia32.h" |
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 __ mov(dst, src); | 1112 __ mov(dst, src); |
| 1113 } else { | 1113 } else { |
| 1114 Operand dst = g.ToOperand(destination); | 1114 Operand dst = g.ToOperand(destination); |
| 1115 __ push(src); | 1115 __ push(src); |
| 1116 __ pop(dst); | 1116 __ pop(dst); |
| 1117 } | 1117 } |
| 1118 } else if (source->IsConstant()) { | 1118 } else if (source->IsConstant()) { |
| 1119 Constant src_constant = g.ToConstant(source); | 1119 Constant src_constant = g.ToConstant(source); |
| 1120 if (src_constant.type() == Constant::kHeapObject) { | 1120 if (src_constant.type() == Constant::kHeapObject) { |
| 1121 Handle<HeapObject> src = src_constant.ToHeapObject(); | 1121 Handle<HeapObject> src = src_constant.ToHeapObject(); |
| 1122 if (destination->IsRegister()) { | 1122 if (info()->IsOptimizing() && src.is_identical_to(info()->context())) { |
| 1123 // Loading the context from the frame is way cheaper than materializing |
| 1124 // the actual context heap object address. |
| 1125 if (destination->IsRegister()) { |
| 1126 Register dst = g.ToRegister(destination); |
| 1127 __ mov(dst, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 1128 } else { |
| 1129 DCHECK(destination->IsStackSlot()); |
| 1130 Operand dst = g.ToOperand(destination); |
| 1131 __ push(Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 1132 __ pop(dst); |
| 1133 } |
| 1134 } else if (destination->IsRegister()) { |
| 1123 Register dst = g.ToRegister(destination); | 1135 Register dst = g.ToRegister(destination); |
| 1124 __ LoadHeapObject(dst, src); | 1136 __ LoadHeapObject(dst, src); |
| 1125 } else { | 1137 } else { |
| 1126 DCHECK(destination->IsStackSlot()); | 1138 DCHECK(destination->IsStackSlot()); |
| 1127 Operand dst = g.ToOperand(destination); | 1139 Operand dst = g.ToOperand(destination); |
| 1128 AllowDeferredHandleDereference embedding_raw_address; | 1140 AllowDeferredHandleDereference embedding_raw_address; |
| 1129 if (isolate()->heap()->InNewSpace(*src)) { | 1141 if (isolate()->heap()->InNewSpace(*src)) { |
| 1130 __ PushHeapObject(src); | 1142 __ PushHeapObject(src); |
| 1131 __ pop(dst); | 1143 __ pop(dst); |
| 1132 } else { | 1144 } else { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 } | 1284 } |
| 1273 } | 1285 } |
| 1274 MarkLazyDeoptSite(); | 1286 MarkLazyDeoptSite(); |
| 1275 } | 1287 } |
| 1276 | 1288 |
| 1277 #undef __ | 1289 #undef __ |
| 1278 | 1290 |
| 1279 } // namespace compiler | 1291 } // namespace compiler |
| 1280 } // namespace internal | 1292 } // namespace internal |
| 1281 } // namespace v8 | 1293 } // namespace v8 |
| OLD | NEW |