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 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2305 } | 2305 } |
2306 | 2306 |
2307 | 2307 |
2308 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) { | 2308 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) { |
2309 mov(r4, Operand(builtin)); | 2309 mov(r4, Operand(builtin)); |
2310 CEntryStub stub(isolate(), 1); | 2310 CEntryStub stub(isolate(), 1); |
2311 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 2311 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
2312 } | 2312 } |
2313 | 2313 |
2314 | 2314 |
2315 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag, | 2315 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, |
2316 const CallWrapper& call_wrapper) { | 2316 const CallWrapper& call_wrapper) { |
2317 // You can't call a builtin without a valid frame. | 2317 // You can't call a builtin without a valid frame. |
2318 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 2318 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
2319 | 2319 |
2320 GetBuiltinEntry(ip, id); | 2320 GetBuiltinEntry(ip, native_context_index); |
2321 if (flag == CALL_FUNCTION) { | 2321 if (flag == CALL_FUNCTION) { |
2322 call_wrapper.BeforeCall(CallSize(ip)); | 2322 call_wrapper.BeforeCall(CallSize(ip)); |
2323 CallJSEntry(ip); | 2323 CallJSEntry(ip); |
2324 call_wrapper.AfterCall(); | 2324 call_wrapper.AfterCall(); |
2325 } else { | 2325 } else { |
2326 DCHECK(flag == JUMP_FUNCTION); | 2326 DCHECK(flag == JUMP_FUNCTION); |
2327 JumpToJSEntry(ip); | 2327 JumpToJSEntry(ip); |
2328 } | 2328 } |
2329 } | 2329 } |
2330 | 2330 |
2331 | 2331 |
2332 void MacroAssembler::GetBuiltinFunction(Register target, | 2332 void MacroAssembler::GetBuiltinFunction(Register target, |
2333 Builtins::JavaScript id) { | 2333 int native_context_index) { |
2334 // Load the builtins object into target register. | 2334 // Load the builtins object into target register. |
2335 LoadP(target, | 2335 LoadP(target, |
2336 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2336 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2337 LoadP(target, FieldMemOperand(target, GlobalObject::kBuiltinsOffset)); | 2337 LoadP(target, FieldMemOperand(target, GlobalObject::kNativeContextOffset)); |
2338 // Load the JavaScript builtin function from the builtins object. | 2338 // Load the JavaScript builtin function from the builtins object. |
2339 LoadP(target, | 2339 LoadP(target, ContextOperand(target, native_context_index), r0); |
2340 FieldMemOperand(target, JSBuiltinsObject::OffsetOfFunctionWithId(id)), | |
2341 r0); | |
2342 } | 2340 } |
2343 | 2341 |
2344 | 2342 |
2345 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { | 2343 void MacroAssembler::GetBuiltinEntry(Register target, |
| 2344 int native_context_index) { |
2346 DCHECK(!target.is(r4)); | 2345 DCHECK(!target.is(r4)); |
2347 GetBuiltinFunction(r4, id); | 2346 GetBuiltinFunction(r4, native_context_index); |
2348 // Load the code entry point from the builtins object. | 2347 // Load the code entry point from the builtins object. |
2349 LoadP(target, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); | 2348 LoadP(target, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); |
2350 } | 2349 } |
2351 | 2350 |
2352 | 2351 |
2353 void MacroAssembler::SetCounter(StatsCounter* counter, int value, | 2352 void MacroAssembler::SetCounter(StatsCounter* counter, int value, |
2354 Register scratch1, Register scratch2) { | 2353 Register scratch1, Register scratch2) { |
2355 if (FLAG_native_code_counters && counter->Enabled()) { | 2354 if (FLAG_native_code_counters && counter->Enabled()) { |
2356 mov(scratch1, Operand(value)); | 2355 mov(scratch1, Operand(value)); |
2357 mov(scratch2, Operand(ExternalReference(counter))); | 2356 mov(scratch2, Operand(ExternalReference(counter))); |
(...skipping 2289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4647 } | 4646 } |
4648 if (mag.shift > 0) srawi(result, result, mag.shift); | 4647 if (mag.shift > 0) srawi(result, result, mag.shift); |
4649 ExtractBit(r0, dividend, 31); | 4648 ExtractBit(r0, dividend, 31); |
4650 add(result, result, r0); | 4649 add(result, result, r0); |
4651 } | 4650 } |
4652 | 4651 |
4653 } // namespace internal | 4652 } // namespace internal |
4654 } // namespace v8 | 4653 } // namespace v8 |
4655 | 4654 |
4656 #endif // V8_TARGET_ARCH_PPC | 4655 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |