X87: Move Maps' back pointers from "transitions" to "constructor" field.

port affcfaf428 (r26835).

original commit message:

  Move Maps' back pointers from "transitions" to "constructor" field

BUG=
R=weiliang.lin@intel.com

Review URL: https://codereview.chromium.org/964783002

Cr-Commit-Position: refs/heads/master@{#26904}
This commit is contained in:
cdai2 2015-02-27 15:02:59 +08:00
parent cd87f25a2e
commit e1030fc97d
4 changed files with 23 additions and 5 deletions

View File

@ -3652,8 +3652,8 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1);
// Check if the constructor in the map is a JS function.
__ mov(eax, FieldOperand(eax, Map::kConstructorOffset));
__ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx);
__ GetMapConstructor(eax, eax, ebx);
__ CmpInstanceType(ebx, JS_FUNCTION_TYPE);
__ j(not_equal, &non_function_constructor);
// eax now contains the constructor function. Grab the

View File

@ -2855,9 +2855,9 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
// Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range.
// Check if the constructor in the map is a function.
__ mov(temp, FieldOperand(temp, Map::kConstructorOffset));
__ GetMapConstructor(temp, temp, temp2);
// Objects with a non-function constructor have class 'Object'.
__ CmpObjectType(temp, JS_FUNCTION_TYPE, temp2);
__ CmpInstanceType(temp2, JS_FUNCTION_TYPE);
if (String::Equals(class_name, isolate()->factory()->Object_string())) {
__ j(not_equal, is_true);
} else {

View File

@ -1883,6 +1883,20 @@ void MacroAssembler::NegativeZeroTest(Register result,
}
void MacroAssembler::GetMapConstructor(Register result, Register map,
Register temp) {
Label done, loop;
mov(result, FieldOperand(map, Map::kConstructorOrBackPointerOffset));
bind(&loop);
JumpIfSmi(result, &done);
CmpObjectType(result, MAP_TYPE, temp);
j(not_equal, &done);
mov(result, FieldOperand(result, Map::kConstructorOrBackPointerOffset));
jmp(&loop);
bind(&done);
}
void MacroAssembler::TryGetFunctionPrototype(Register function,
Register result,
Register scratch,
@ -1934,7 +1948,7 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
// Non-instance prototype: Fetch prototype from constructor field
// in initial map.
bind(&non_instance);
mov(result, FieldOperand(result, Map::kConstructorOffset));
GetMapConstructor(result, result, scratch);
}
// All done.

View File

@ -683,6 +683,10 @@ class MacroAssembler: public Assembler {
void NegativeZeroTest(Register result, Register op1, Register op2,
Register scratch, Label* then_label);
// Machine code version of Map::GetConstructor().
// |temp| holds |result|'s map when done.
void GetMapConstructor(Register result, Register map, Register temp);
// Try to get function prototype of a function and puts the value in
// the result register. Checks that the function really is a
// function and jumps to the miss label if the fast checks fail. The