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

Side by Side Diff: src/mips64/macro-assembler-mips64.cc

Issue 1316543002: MIPS: Correctify instanceof and make it optimizable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 <limits.h> // For LONG_MIN, LONG_MAX. 5 #include <limits.h> // For LONG_MIN, LONG_MAX.
6 6
7 #if V8_TARGET_ARCH_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 #include "src/base/division-by-constant.h" 9 #include "src/base/division-by-constant.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 4255 matching lines...) Expand 10 before | Expand all | Expand 10 after
4266 bind(&loop); 4266 bind(&loop);
4267 JumpIfSmi(result, &done); 4267 JumpIfSmi(result, &done);
4268 GetObjectType(result, temp, temp2); 4268 GetObjectType(result, temp, temp2);
4269 Branch(&done, ne, temp2, Operand(MAP_TYPE)); 4269 Branch(&done, ne, temp2, Operand(MAP_TYPE));
4270 ld(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset)); 4270 ld(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset));
4271 Branch(&loop); 4271 Branch(&loop);
4272 bind(&done); 4272 bind(&done);
4273 } 4273 }
4274 4274
4275 4275
4276 void MacroAssembler::TryGetFunctionPrototype(Register function, 4276 void MacroAssembler::TryGetFunctionPrototype(Register function, Register result,
4277 Register result, 4277 Register scratch, Label* miss) {
4278 Register scratch,
4279 Label* miss,
4280 bool miss_on_bound_function) {
4281 Label non_instance;
4282 if (miss_on_bound_function) {
4283 // Check that the receiver isn't a smi.
4284 JumpIfSmi(function, miss);
4285
4286 // Check that the function really is a function. Load map into result reg.
4287 GetObjectType(function, result, scratch);
4288 Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE));
4289
4290 ld(scratch,
4291 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
4292 lwu(scratch,
4293 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
4294 And(scratch, scratch,
4295 Operand(1 << SharedFunctionInfo::kBoundFunction));
4296 Branch(miss, ne, scratch, Operand(zero_reg));
4297
4298 // Make sure that the function has an instance prototype.
4299 lbu(scratch, FieldMemOperand(result, Map::kBitFieldOffset));
4300 And(scratch, scratch, Operand(1 << Map::kHasNonInstancePrototype));
4301 Branch(&non_instance, ne, scratch, Operand(zero_reg));
4302 }
4303
4304 // Get the prototype or initial map from the function. 4278 // Get the prototype or initial map from the function.
4305 ld(result, 4279 ld(result,
4306 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); 4280 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
4307 4281
4308 // If the prototype or initial map is the hole, don't return it and 4282 // If the prototype or initial map is the hole, don't return it and
4309 // simply miss the cache instead. This will allow us to allocate a 4283 // simply miss the cache instead. This will allow us to allocate a
4310 // prototype object on-demand in the runtime system. 4284 // prototype object on-demand in the runtime system.
4311 LoadRoot(t8, Heap::kTheHoleValueRootIndex); 4285 LoadRoot(t8, Heap::kTheHoleValueRootIndex);
4312 Branch(miss, eq, result, Operand(t8)); 4286 Branch(miss, eq, result, Operand(t8));
4313 4287
4314 // If the function does not have an initial map, we're done. 4288 // If the function does not have an initial map, we're done.
4315 Label done; 4289 Label done;
4316 GetObjectType(result, scratch, scratch); 4290 GetObjectType(result, scratch, scratch);
4317 Branch(&done, ne, scratch, Operand(MAP_TYPE)); 4291 Branch(&done, ne, scratch, Operand(MAP_TYPE));
4318 4292
4319 // Get the prototype from the initial map. 4293 // Get the prototype from the initial map.
4320 ld(result, FieldMemOperand(result, Map::kPrototypeOffset)); 4294 ld(result, FieldMemOperand(result, Map::kPrototypeOffset));
4321 4295
4322 if (miss_on_bound_function) {
4323 jmp(&done);
4324
4325 // Non-instance prototype: Fetch prototype from constructor field
4326 // in initial map.
4327 bind(&non_instance);
4328 GetMapConstructor(result, result, scratch, scratch);
4329 }
4330
4331 // All done. 4296 // All done.
4332 bind(&done); 4297 bind(&done);
4333 } 4298 }
4334 4299
4335 4300
4336 void MacroAssembler::GetObjectType(Register object, 4301 void MacroAssembler::GetObjectType(Register object,
4337 Register map, 4302 Register map,
4338 Register type_reg) { 4303 Register type_reg) {
4339 ld(map, FieldMemOperand(object, HeapObject::kMapOffset)); 4304 ld(map, FieldMemOperand(object, HeapObject::kMapOffset));
4340 lbu(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); 4305 lbu(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset));
(...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after
6340 if (mag.shift > 0) sra(result, result, mag.shift); 6305 if (mag.shift > 0) sra(result, result, mag.shift);
6341 srl(at, dividend, 31); 6306 srl(at, dividend, 31);
6342 Addu(result, result, Operand(at)); 6307 Addu(result, result, Operand(at));
6343 } 6308 }
6344 6309
6345 6310
6346 } // namespace internal 6311 } // namespace internal
6347 } // namespace v8 6312 } // namespace v8
6348 6313
6349 #endif // V8_TARGET_ARCH_MIPS64 6314 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.h ('k') | src/objects.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698