Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: src/ppc/macro-assembler-ppc.cc

Issue 1314263002: PPC: Correctify instanceof and make it optimizable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ppc/macro-assembler-ppc.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/macro-assembler-ppc.cc
diff --git a/src/ppc/macro-assembler-ppc.cc b/src/ppc/macro-assembler-ppc.cc
index 8148818cd39f0b6d7387fe710c15f4a83dc9dcdd..8e1447b7f11d89d3651d11df65a6508ee5136201 100644
--- a/src/ppc/macro-assembler-ppc.cc
+++ b/src/ppc/macro-assembler-ppc.cc
@@ -1979,36 +1979,7 @@ void MacroAssembler::GetMapConstructor(Register result, Register map,
void MacroAssembler::TryGetFunctionPrototype(Register function, Register result,
- Register scratch, Label* miss,
- bool miss_on_bound_function) {
- Label non_instance;
- if (miss_on_bound_function) {
- // Check that the receiver isn't a smi.
- JumpIfSmi(function, miss);
-
- // Check that the function really is a function. Load map into result reg.
- CompareObjectType(function, result, scratch, JS_FUNCTION_TYPE);
- bne(miss);
-
- LoadP(scratch,
- FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
- lwz(scratch,
- FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
- TestBit(scratch,
-#if V8_TARGET_ARCH_PPC64
- SharedFunctionInfo::kBoundFunction,
-#else
- SharedFunctionInfo::kBoundFunction + kSmiTagSize,
-#endif
- r0);
- bne(miss, cr0);
-
- // Make sure that the function has an instance prototype.
- lbz(scratch, FieldMemOperand(result, Map::kBitFieldOffset));
- andi(r0, scratch, Operand(1 << Map::kHasNonInstancePrototype));
- bne(&non_instance, cr0);
- }
-
+ Register scratch, Label* miss) {
// Get the prototype or initial map from the function.
LoadP(result,
FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
@@ -2028,15 +1999,6 @@ void MacroAssembler::TryGetFunctionPrototype(Register function, Register result,
// Get the prototype from the initial map.
LoadP(result, FieldMemOperand(result, Map::kPrototypeOffset));
- if (miss_on_bound_function) {
- b(&done);
-
- // Non-instance prototype: Fetch prototype from constructor field
- // in initial map.
- bind(&non_instance);
- GetMapConstructor(result, result, scratch, ip);
- }
-
// All done.
bind(&done);
}
@@ -3243,175 +3205,6 @@ void MacroAssembler::DecodeConstantPoolOffset(Register result,
}
-void MacroAssembler::SetRelocatedValue(Register location, Register scratch,
- Register new_value) {
- lwz(scratch, MemOperand(location));
-
- if (FLAG_enable_embedded_constant_pool) {
- if (emit_debug_code()) {
- // Check that the instruction sequence is a load from the constant pool
- ExtractBitMask(scratch, scratch, 0x1f * B16);
- cmpi(scratch, Operand(kConstantPoolRegister.code()));
- Check(eq, kTheInstructionToPatchShouldBeALoadFromConstantPool);
- // Scratch was clobbered. Restore it.
- lwz(scratch, MemOperand(location));
- }
- DecodeConstantPoolOffset(scratch, location);
- StorePX(new_value, MemOperand(kConstantPoolRegister, scratch));
- return;
- }
-
- // This code assumes a FIXED_SEQUENCE for lis/ori
-
- // At this point scratch is a lis instruction.
- if (emit_debug_code()) {
- And(scratch, scratch, Operand(kOpcodeMask | (0x1f * B16)));
- Cmpi(scratch, Operand(ADDIS), r0);
- Check(eq, kTheInstructionToPatchShouldBeALis);
- lwz(scratch, MemOperand(location));
- }
-
-// insert new high word into lis instruction
-#if V8_TARGET_ARCH_PPC64
- srdi(ip, new_value, Operand(32));
- rlwimi(scratch, ip, 16, 16, 31);
-#else
- rlwimi(scratch, new_value, 16, 16, 31);
-#endif
-
- stw(scratch, MemOperand(location));
-
- lwz(scratch, MemOperand(location, kInstrSize));
- // scratch is now ori.
- if (emit_debug_code()) {
- And(scratch, scratch, Operand(kOpcodeMask));
- Cmpi(scratch, Operand(ORI), r0);
- Check(eq, kTheInstructionShouldBeAnOri);
- lwz(scratch, MemOperand(location, kInstrSize));
- }
-
-// insert new low word into ori instruction
-#if V8_TARGET_ARCH_PPC64
- rlwimi(scratch, ip, 0, 16, 31);
-#else
- rlwimi(scratch, new_value, 0, 16, 31);
-#endif
- stw(scratch, MemOperand(location, kInstrSize));
-
-#if V8_TARGET_ARCH_PPC64
- if (emit_debug_code()) {
- lwz(scratch, MemOperand(location, 2 * kInstrSize));
- // scratch is now sldi.
- And(scratch, scratch, Operand(kOpcodeMask | kExt5OpcodeMask));
- Cmpi(scratch, Operand(EXT5 | RLDICR), r0);
- Check(eq, kTheInstructionShouldBeASldi);
- }
-
- lwz(scratch, MemOperand(location, 3 * kInstrSize));
- // scratch is now ori.
- if (emit_debug_code()) {
- And(scratch, scratch, Operand(kOpcodeMask));
- Cmpi(scratch, Operand(ORIS), r0);
- Check(eq, kTheInstructionShouldBeAnOris);
- lwz(scratch, MemOperand(location, 3 * kInstrSize));
- }
-
- rlwimi(scratch, new_value, 16, 16, 31);
- stw(scratch, MemOperand(location, 3 * kInstrSize));
-
- lwz(scratch, MemOperand(location, 4 * kInstrSize));
- // scratch is now ori.
- if (emit_debug_code()) {
- And(scratch, scratch, Operand(kOpcodeMask));
- Cmpi(scratch, Operand(ORI), r0);
- Check(eq, kTheInstructionShouldBeAnOri);
- lwz(scratch, MemOperand(location, 4 * kInstrSize));
- }
- rlwimi(scratch, new_value, 0, 16, 31);
- stw(scratch, MemOperand(location, 4 * kInstrSize));
-#endif
-
-// Update the I-cache so the new lis and addic can be executed.
-#if V8_TARGET_ARCH_PPC64
- FlushICache(location, 5 * kInstrSize, scratch);
-#else
- FlushICache(location, 2 * kInstrSize, scratch);
-#endif
-}
-
-
-void MacroAssembler::GetRelocatedValue(Register location, Register result,
- Register scratch) {
- lwz(result, MemOperand(location));
-
- if (FLAG_enable_embedded_constant_pool) {
- if (emit_debug_code()) {
- // Check that the instruction sequence is a load from the constant pool
- ExtractBitMask(result, result, 0x1f * B16);
- cmpi(result, Operand(kConstantPoolRegister.code()));
- Check(eq, kTheInstructionToPatchShouldBeALoadFromConstantPool);
- lwz(result, MemOperand(location));
- }
- DecodeConstantPoolOffset(result, location);
- LoadPX(result, MemOperand(kConstantPoolRegister, result));
- return;
- }
-
- // This code assumes a FIXED_SEQUENCE for lis/ori
- if (emit_debug_code()) {
- And(result, result, Operand(kOpcodeMask | (0x1f * B16)));
- Cmpi(result, Operand(ADDIS), r0);
- Check(eq, kTheInstructionShouldBeALis);
- lwz(result, MemOperand(location));
- }
-
- // result now holds a lis instruction. Extract the immediate.
- slwi(result, result, Operand(16));
-
- lwz(scratch, MemOperand(location, kInstrSize));
- if (emit_debug_code()) {
- And(scratch, scratch, Operand(kOpcodeMask));
- Cmpi(scratch, Operand(ORI), r0);
- Check(eq, kTheInstructionShouldBeAnOri);
- lwz(scratch, MemOperand(location, kInstrSize));
- }
- // Copy the low 16bits from ori instruction into result
- rlwimi(result, scratch, 0, 16, 31);
-
-#if V8_TARGET_ARCH_PPC64
- if (emit_debug_code()) {
- lwz(scratch, MemOperand(location, 2 * kInstrSize));
- // scratch is now sldi.
- And(scratch, scratch, Operand(kOpcodeMask | kExt5OpcodeMask));
- Cmpi(scratch, Operand(EXT5 | RLDICR), r0);
- Check(eq, kTheInstructionShouldBeASldi);
- }
-
- lwz(scratch, MemOperand(location, 3 * kInstrSize));
- // scratch is now ori.
- if (emit_debug_code()) {
- And(scratch, scratch, Operand(kOpcodeMask));
- Cmpi(scratch, Operand(ORIS), r0);
- Check(eq, kTheInstructionShouldBeAnOris);
- lwz(scratch, MemOperand(location, 3 * kInstrSize));
- }
- sldi(result, result, Operand(16));
- rldimi(result, scratch, 0, 48);
-
- lwz(scratch, MemOperand(location, 4 * kInstrSize));
- // scratch is now ori.
- if (emit_debug_code()) {
- And(scratch, scratch, Operand(kOpcodeMask));
- Cmpi(scratch, Operand(ORI), r0);
- Check(eq, kTheInstructionShouldBeAnOri);
- lwz(scratch, MemOperand(location, 4 * kInstrSize));
- }
- sldi(result, result, Operand(16));
- rldimi(result, scratch, 0, 48);
-#endif
-}
-
-
void MacroAssembler::CheckPageFlag(
Register object,
Register scratch, // scratch may be same register as object
« no previous file with comments | « src/ppc/macro-assembler-ppc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698