Move JS_VALUE_TYPE ahead of JS_OBJECT_TYPE to save one comparison in

KeyedLoadIC::GenerateGeneric (on IA32), and the same on ARM.
Re-assignmed FIRST_JS_OBJECT_TYPE to JS_VALUE_TYPE.

Also changed JS_OBJECT_TYPE to FIRST_JS_OBJECT_TYPE in several places where
FIRST_JS_OBJECT_TYPE is intended.



git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@113 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
feng.qian.v8 2008-09-02 23:52:50 +00:00
parent 6287c675d8
commit 194baea8ca
7 changed files with 25 additions and 27 deletions

View File

@ -106,10 +106,10 @@ void Builtins::Generate_JSConstructCall(MacroAssembler* masm) {
__ b(eq, &use_receiver);
// If the type of the result (stored in its map) is less than
// JS_OBJECT type, it is not an object in the ECMA sense.
// FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense.
__ ldr(r2, FieldMemOperand(r0, HeapObject::kMapOffset));
__ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset));
__ cmp(r2, Operand(JS_OBJECT_TYPE));
__ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE));
__ b(ge, &exit);
// Throw away the result of the constructor invocation and use the

View File

@ -282,10 +282,10 @@ void Builtins::Generate_JSConstructCall(MacroAssembler* masm) {
__ j(zero, &use_receiver, not_taken);
// If the type of the result (stored in its map) is less than
// JS_OBJECT type, it is not an object in the ECMA sense.
// FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense.
__ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset));
__ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
__ cmp(ecx, JS_OBJECT_TYPE);
__ cmp(ecx, FIRST_JS_OBJECT_TYPE);
__ j(greater_equal, &exit, not_taken);
// Throw away the result of the constructor invocation and use the

View File

@ -901,18 +901,17 @@ void GetPropertyStub::Generate(MacroAssembler* masm) {
// Check that the object isn't a smi.
__ tst(r1, Operand(kSmiTagMask));
__ b(eq, &slow);
// Check that the object is some kind of JS object.
// Check that the object is some kind of JS object EXCEPT JS Value type.
// In the case that the object is a value-wrapper object,
// we enter the runtime system to make sure that indexing into string
// objects work as intended.
ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE);
__ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset));
__ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset));
__ cmp(r2, Operand(JS_OBJECT_TYPE));
__ b(lt, &slow);
// Check if the object is a value-wrapper object. In that case we
// enter the runtime system to make sure that indexing into string
// objects work as intended.
__ cmp(r2, Operand(JS_VALUE_TYPE));
__ b(eq, &slow);
// Get the elements array of the object.
__ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset));
// Check that the object is in fast mode (not dictionary).
@ -979,7 +978,7 @@ void SetPropertyStub::Generate(MacroAssembler* masm) {
__ cmp(r2, Operand(JS_ARRAY_TYPE));
__ b(eq, &array);
// Check that the object is some kind of JS object.
__ cmp(r2, Operand(JS_OBJECT_TYPE));
__ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE));
__ b(lt, &slow);
@ -2692,7 +2691,7 @@ void ArmCodeGenerator::VisitForInStatement(ForInStatement* node) {
__ b(eq, &primitive);
__ ldr(r1, FieldMemOperand(r0, HeapObject::kMapOffset));
__ ldrb(r1, FieldMemOperand(r1, Map::kInstanceTypeOffset));
__ cmp(r1, Operand(JS_OBJECT_TYPE));
__ cmp(r1, Operand(FIRST_JS_OBJECT_TYPE));
__ b(hs, &jsobject);
__ bind(&primitive);

View File

@ -905,7 +905,7 @@ void ToBooleanStub::Generate(MacroAssembler* masm) {
__ j(not_zero, &false_result);
// JavaScript object => true.
__ cmp(ecx, JS_OBJECT_TYPE);
__ cmp(ecx, FIRST_JS_OBJECT_TYPE);
__ j(above_equal, &true_result);
// String value => false iff empty.
@ -2896,7 +2896,7 @@ void Ia32CodeGenerator::VisitForInStatement(ForInStatement* node) {
__ j(zero, &primitive);
__ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset));
__ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
__ cmp(ecx, JS_OBJECT_TYPE);
__ cmp(ecx, FIRST_JS_OBJECT_TYPE);
__ j(above_equal, &jsobject);
__ bind(&primitive);

View File

@ -223,7 +223,11 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// Check that the object isn't a smi.
__ test(ecx, Immediate(kSmiTagMask));
__ j(zero, &slow, not_taken);
// Check that the object is some kind of JS object.
// Check that the object is some kind of JS object EXCEPT JS Value type.
// In the case that the object is a value-wrapper object,
// we enter the runtime system to make sure that indexing
// into string objects work as intended.
ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE);
__ mov(edx, FieldOperand(ecx, HeapObject::kMapOffset));
__ movzx_b(edx, FieldOperand(edx, Map::kInstanceTypeOffset));
__ cmp(edx, JS_OBJECT_TYPE);
@ -232,11 +236,6 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
__ test(eax, Immediate(kSmiTagMask));
__ j(not_zero, &check_string, not_taken);
__ sar(eax, kSmiTagSize);
// Check if the object is a value-wrapper object. In that case we
// enter the runtime system to make sure that indexing into string
// objects work as intended.
__ cmp(edx, JS_VALUE_TYPE);
__ j(equal, &slow, not_taken);
// Get the elements array of the object.
__ mov(ecx, FieldOperand(ecx, JSObject::kElementsOffset));
// Check that the object is in fast mode (not dictionary).
@ -300,7 +299,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
__ cmp(ecx, JS_ARRAY_TYPE);
__ j(equal, &array);
// Check that the object is some kind of JS object.
__ cmp(ecx, JS_OBJECT_TYPE);
__ cmp(ecx, FIRST_JS_OBJECT_TYPE);
__ j(less, &slow, not_taken);

View File

@ -206,7 +206,7 @@ bool Object::IsException() {
bool Object::IsJSObject() {
return IsHeapObject()
&& HeapObject::cast(this)->map()->instance_type() >= JS_OBJECT_TYPE;
&& HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_OBJECT_TYPE;
}

View File

@ -182,7 +182,7 @@ class PropertyDetails BASE_EMBEDDED {
// HeapObject::Size, HeapObject::IterateBody, the typeof operator, and
// Object::IsString.
//
// NOTE: Everything following JS_OBJECT_TYPE is considered a
// NOTE: Everything following JS_VALUE_TYPE is considered a
// JSObject for GC purposes. The first four entries here have typeof
// 'object', whereas JS_FUNCTION_TYPE has typeof 'function'.
#define INSTANCE_TYPE_LIST(V) \
@ -258,10 +258,10 @@ class PropertyDetails BASE_EMBEDDED {
V(BREAK_POINT_INFO_TYPE) \
V(SCRIPT_TYPE) \
\
V(JS_VALUE_TYPE) \
V(JS_OBJECT_TYPE) \
V(JS_GLOBAL_OBJECT_TYPE) \
V(JS_BUILTINS_OBJECT_TYPE) \
V(JS_VALUE_TYPE) \
V(JS_ARRAY_TYPE) \
\
V(JS_FUNCTION_TYPE) \
@ -512,10 +512,10 @@ enum InstanceType {
BREAK_POINT_INFO_TYPE,
SCRIPT_TYPE,
JS_VALUE_TYPE,
JS_OBJECT_TYPE,
JS_GLOBAL_OBJECT_TYPE,
JS_BUILTINS_OBJECT_TYPE,
JS_VALUE_TYPE,
JS_ARRAY_TYPE,
JS_FUNCTION_TYPE,
@ -527,7 +527,7 @@ enum InstanceType {
// Boundaries for testing the type is a JavaScript "object". Note that
// function objects are not counted as objects, even though they are
// implemented as such; only values whose typeof is "object" are included.
FIRST_JS_OBJECT_TYPE = JS_OBJECT_TYPE,
FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE,
LAST_JS_OBJECT_TYPE = JS_ARRAY_TYPE
};