| 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 <assert.h> // For assert | 5 #include <assert.h> // For assert |
| 6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 7 | 7 |
| 8 #if V8_TARGET_ARCH_PPC | 8 #if V8_TARGET_ARCH_PPC |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 // In debug mode, make sure the lexical context is set. | 1204 // In debug mode, make sure the lexical context is set. |
| 1205 #ifdef DEBUG | 1205 #ifdef DEBUG |
| 1206 cmpi(scratch, Operand::Zero()); | 1206 cmpi(scratch, Operand::Zero()); |
| 1207 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext); | 1207 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext); |
| 1208 #endif | 1208 #endif |
| 1209 | 1209 |
| 1210 // Load the native context of the current context. | 1210 // Load the native context of the current context. |
| 1211 int offset = | 1211 int offset = |
| 1212 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | 1212 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
| 1213 LoadP(scratch, FieldMemOperand(scratch, offset)); | 1213 LoadP(scratch, FieldMemOperand(scratch, offset)); |
| 1214 LoadP(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | 1214 LoadP(scratch, |
| 1215 FieldMemOperand(scratch, JSGlobalObject::kNativeContextOffset)); |
| 1215 | 1216 |
| 1216 // Check the context is a native context. | 1217 // Check the context is a native context. |
| 1217 if (emit_debug_code()) { | 1218 if (emit_debug_code()) { |
| 1218 // Cannot use ip as a temporary in this verification code. Due to the fact | 1219 // Cannot use ip as a temporary in this verification code. Due to the fact |
| 1219 // that ip is clobbered as part of cmp with an object Operand. | 1220 // that ip is clobbered as part of cmp with an object Operand. |
| 1220 push(holder_reg); // Temporarily save holder on the stack. | 1221 push(holder_reg); // Temporarily save holder on the stack. |
| 1221 // Read the first word and compare to the native_context_map. | 1222 // Read the first word and compare to the native_context_map. |
| 1222 LoadP(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); | 1223 LoadP(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
| 1223 LoadRoot(ip, Heap::kNativeContextMapRootIndex); | 1224 LoadRoot(ip, Heap::kNativeContextMapRootIndex); |
| 1224 cmp(holder_reg, ip); | 1225 cmp(holder_reg, ip); |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2271 JumpToJSEntry(ip); | 2272 JumpToJSEntry(ip); |
| 2272 } | 2273 } |
| 2273 } | 2274 } |
| 2274 | 2275 |
| 2275 | 2276 |
| 2276 void MacroAssembler::GetBuiltinFunction(Register target, | 2277 void MacroAssembler::GetBuiltinFunction(Register target, |
| 2277 int native_context_index) { | 2278 int native_context_index) { |
| 2278 // Load the builtins object into target register. | 2279 // Load the builtins object into target register. |
| 2279 LoadP(target, | 2280 LoadP(target, |
| 2280 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2281 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 2281 LoadP(target, FieldMemOperand(target, GlobalObject::kNativeContextOffset)); | 2282 LoadP(target, FieldMemOperand(target, JSGlobalObject::kNativeContextOffset)); |
| 2282 // Load the JavaScript builtin function from the builtins object. | 2283 // Load the JavaScript builtin function from the builtins object. |
| 2283 LoadP(target, ContextOperand(target, native_context_index), r0); | 2284 LoadP(target, ContextOperand(target, native_context_index), r0); |
| 2284 } | 2285 } |
| 2285 | 2286 |
| 2286 | 2287 |
| 2287 void MacroAssembler::GetBuiltinEntry(Register target, | 2288 void MacroAssembler::GetBuiltinEntry(Register target, |
| 2288 int native_context_index) { | 2289 int native_context_index) { |
| 2289 DCHECK(!target.is(r4)); | 2290 DCHECK(!target.is(r4)); |
| 2290 GetBuiltinFunction(r4, native_context_index); | 2291 GetBuiltinFunction(r4, native_context_index); |
| 2291 // Load the code entry point from the builtins object. | 2292 // Load the code entry point from the builtins object. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 // Slot is in the current function context. Move it into the | 2407 // Slot is in the current function context. Move it into the |
| 2407 // destination register in case we store into it (the write barrier | 2408 // destination register in case we store into it (the write barrier |
| 2408 // cannot be allowed to destroy the context in esi). | 2409 // cannot be allowed to destroy the context in esi). |
| 2409 mr(dst, cp); | 2410 mr(dst, cp); |
| 2410 } | 2411 } |
| 2411 } | 2412 } |
| 2412 | 2413 |
| 2413 | 2414 |
| 2414 void MacroAssembler::LoadGlobalProxy(Register dst) { | 2415 void MacroAssembler::LoadGlobalProxy(Register dst) { |
| 2415 LoadP(dst, GlobalObjectOperand()); | 2416 LoadP(dst, GlobalObjectOperand()); |
| 2416 LoadP(dst, FieldMemOperand(dst, GlobalObject::kGlobalProxyOffset)); | 2417 LoadP(dst, FieldMemOperand(dst, JSGlobalObject::kGlobalProxyOffset)); |
| 2417 } | 2418 } |
| 2418 | 2419 |
| 2419 | 2420 |
| 2420 void MacroAssembler::LoadTransitionedArrayMapConditional( | 2421 void MacroAssembler::LoadTransitionedArrayMapConditional( |
| 2421 ElementsKind expected_kind, ElementsKind transitioned_kind, | 2422 ElementsKind expected_kind, ElementsKind transitioned_kind, |
| 2422 Register map_in_out, Register scratch, Label* no_map_match) { | 2423 Register map_in_out, Register scratch, Label* no_map_match) { |
| 2423 // Load the global or builtins object from the current context. | 2424 // Load the global or builtins object from the current context. |
| 2424 LoadP(scratch, | 2425 LoadP(scratch, |
| 2425 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2426 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 2426 LoadP(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | 2427 LoadP(scratch, |
| 2428 FieldMemOperand(scratch, JSGlobalObject::kNativeContextOffset)); |
| 2427 | 2429 |
| 2428 // Check that the function's map is the same as the expected cached map. | 2430 // Check that the function's map is the same as the expected cached map. |
| 2429 LoadP(scratch, | 2431 LoadP(scratch, |
| 2430 MemOperand(scratch, Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 2432 MemOperand(scratch, Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
| 2431 size_t offset = expected_kind * kPointerSize + FixedArrayBase::kHeaderSize; | 2433 size_t offset = expected_kind * kPointerSize + FixedArrayBase::kHeaderSize; |
| 2432 LoadP(ip, FieldMemOperand(scratch, offset)); | 2434 LoadP(ip, FieldMemOperand(scratch, offset)); |
| 2433 cmp(map_in_out, ip); | 2435 cmp(map_in_out, ip); |
| 2434 bne(no_map_match); | 2436 bne(no_map_match); |
| 2435 | 2437 |
| 2436 // Use the transitioned cached map. | 2438 // Use the transitioned cached map. |
| 2437 offset = transitioned_kind * kPointerSize + FixedArrayBase::kHeaderSize; | 2439 offset = transitioned_kind * kPointerSize + FixedArrayBase::kHeaderSize; |
| 2438 LoadP(map_in_out, FieldMemOperand(scratch, offset)); | 2440 LoadP(map_in_out, FieldMemOperand(scratch, offset)); |
| 2439 } | 2441 } |
| 2440 | 2442 |
| 2441 | 2443 |
| 2442 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 2444 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
| 2443 // Load the global or builtins object from the current context. | 2445 // Load the global or builtins object from the current context. |
| 2444 LoadP(function, | 2446 LoadP(function, |
| 2445 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2447 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 2446 // Load the native context from the global or builtins object. | 2448 // Load the native context from the global or builtins object. |
| 2447 LoadP(function, | 2449 LoadP(function, |
| 2448 FieldMemOperand(function, GlobalObject::kNativeContextOffset)); | 2450 FieldMemOperand(function, JSGlobalObject::kNativeContextOffset)); |
| 2449 // Load the function from the native context. | 2451 // Load the function from the native context. |
| 2450 LoadP(function, MemOperand(function, Context::SlotOffset(index)), r0); | 2452 LoadP(function, MemOperand(function, Context::SlotOffset(index)), r0); |
| 2451 } | 2453 } |
| 2452 | 2454 |
| 2453 | 2455 |
| 2454 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 2456 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
| 2455 Register map, | 2457 Register map, |
| 2456 Register scratch) { | 2458 Register scratch) { |
| 2457 // Load the initial map. The global functions all have initial maps. | 2459 // Load the initial map. The global functions all have initial maps. |
| 2458 LoadP(map, | 2460 LoadP(map, |
| (...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4390 } | 4392 } |
| 4391 if (mag.shift > 0) srawi(result, result, mag.shift); | 4393 if (mag.shift > 0) srawi(result, result, mag.shift); |
| 4392 ExtractBit(r0, dividend, 31); | 4394 ExtractBit(r0, dividend, 31); |
| 4393 add(result, result, r0); | 4395 add(result, result, r0); |
| 4394 } | 4396 } |
| 4395 | 4397 |
| 4396 } // namespace internal | 4398 } // namespace internal |
| 4397 } // namespace v8 | 4399 } // namespace v8 |
| 4398 | 4400 |
| 4399 #endif // V8_TARGET_ARCH_PPC | 4401 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |