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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 7737036: Reorganize object type enum, such that proxies are no longer in the middle (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Erik's comments. Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 // the temp registers, but not the input. Only input and temp2 may alias. 1911 // the temp registers, but not the input. Only input and temp2 may alias.
1912 void LCodeGen::EmitClassOfTest(Label* is_true, 1912 void LCodeGen::EmitClassOfTest(Label* is_true,
1913 Label* is_false, 1913 Label* is_false,
1914 Handle<String>class_name, 1914 Handle<String>class_name,
1915 Register input, 1915 Register input,
1916 Register temp, 1916 Register temp,
1917 Register temp2) { 1917 Register temp2) {
1918 ASSERT(!input.is(temp)); 1918 ASSERT(!input.is(temp));
1919 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register. 1919 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register.
1920 __ JumpIfSmi(input, is_false); 1920 __ JumpIfSmi(input, is_false);
1921 __ CompareObjectType(input, temp, temp2, FIRST_SPEC_OBJECT_TYPE);
1922 __ b(lt, is_false);
1923 1921
1924 // Map is now in temp.
1925 // Functions have class 'Function'.
1926 __ CompareInstanceType(temp, temp2, FIRST_CALLABLE_SPEC_OBJECT_TYPE);
1927 if (class_name->IsEqualTo(CStrVector("Function"))) { 1922 if (class_name->IsEqualTo(CStrVector("Function"))) {
1928 __ b(ge, is_true); 1923 // Assuming the following assertions, we can use the same compares to test
1924 // for both being a function type and being in the object type range.
1925 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
1926 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE ==
1927 FIRST_SPEC_OBJECT_TYPE + 1);
1928 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE ==
1929 LAST_SPEC_OBJECT_TYPE - 1);
1930 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
1931 __ CompareObjectType(input, temp, temp2, FIRST_SPEC_OBJECT_TYPE);
1932 __ b(lt, is_false);
1933 __ b(eq, is_true);
1934 __ cmp(temp2, Operand(LAST_SPEC_OBJECT_TYPE));
1935 __ b(eq, is_true);
1929 } else { 1936 } else {
1930 __ b(ge, is_false); 1937 // Faster code path to avoid two compares: subtract lower bound from the
1938 // actual type and do a signed compare with the width of the type range.
1939 __ ldr(temp, FieldMemOperand(input, HeapObject::kMapOffset));
1940 __ ldrb(temp2, FieldMemOperand(temp, Map::kInstanceTypeOffset));
1941 __ sub(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE));
1942 __ cmp(temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE -
1943 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE));
1944 __ b(gt, is_false);
1931 } 1945 }
1932 1946
1947 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range.
1933 // Check if the constructor in the map is a function. 1948 // Check if the constructor in the map is a function.
1934 __ ldr(temp, FieldMemOperand(temp, Map::kConstructorOffset)); 1949 __ ldr(temp, FieldMemOperand(temp, Map::kConstructorOffset));
1935 1950
1936 // As long as LAST_CALLABLE_SPEC_OBJECT_TYPE is the last instance type and
1937 // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after
1938 // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter.
1939 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE);
1940 STATIC_ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE ==
1941 LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1);
1942
1943 // Objects with a non-function constructor have class 'Object'. 1951 // Objects with a non-function constructor have class 'Object'.
1944 __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE); 1952 __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE);
1945 if (class_name->IsEqualTo(CStrVector("Object"))) { 1953 if (class_name->IsEqualTo(CStrVector("Object"))) {
1946 __ b(ne, is_true); 1954 __ b(ne, is_true);
1947 } else { 1955 } else {
1948 __ b(ne, is_false); 1956 __ b(ne, is_false);
1949 } 1957 }
1950 1958
1951 // temp now contains the constructor function. Grab the 1959 // temp now contains the constructor function. Grab the
1952 // instance class name from there. 1960 // instance class name from there.
(...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after
4336 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); 4344 __ CompareRoot(input, Heap::kUndefinedValueRootIndex);
4337 __ b(eq, true_label); 4345 __ b(eq, true_label);
4338 __ JumpIfSmi(input, false_label); 4346 __ JumpIfSmi(input, false_label);
4339 // Check for undetectable objects => true. 4347 // Check for undetectable objects => true.
4340 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); 4348 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset));
4341 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); 4349 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset));
4342 __ tst(ip, Operand(1 << Map::kIsUndetectable)); 4350 __ tst(ip, Operand(1 << Map::kIsUndetectable));
4343 final_branch_condition = ne; 4351 final_branch_condition = ne;
4344 4352
4345 } else if (type_name->Equals(heap()->function_symbol())) { 4353 } else if (type_name->Equals(heap()->function_symbol())) {
4354 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
4346 __ JumpIfSmi(input, false_label); 4355 __ JumpIfSmi(input, false_label);
4347 __ CompareObjectType(input, input, scratch, 4356 __ CompareObjectType(input, scratch, input, JS_FUNCTION_TYPE);
4348 FIRST_CALLABLE_SPEC_OBJECT_TYPE); 4357 __ b(eq, true_label);
4349 final_branch_condition = ge; 4358 __ cmp(input, Operand(JS_FUNCTION_PROXY_TYPE));
4359 final_branch_condition = eq;
4350 4360
4351 } else if (type_name->Equals(heap()->object_symbol())) { 4361 } else if (type_name->Equals(heap()->object_symbol())) {
4352 __ JumpIfSmi(input, false_label); 4362 __ JumpIfSmi(input, false_label);
4353 if (!FLAG_harmony_typeof) { 4363 if (!FLAG_harmony_typeof) {
4354 __ CompareRoot(input, Heap::kNullValueRootIndex); 4364 __ CompareRoot(input, Heap::kNullValueRootIndex);
4355 __ b(eq, true_label); 4365 __ b(eq, true_label);
4356 } 4366 }
4357 __ CompareObjectType(input, input, scratch, 4367 __ CompareObjectType(input, input, scratch,
4358 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); 4368 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE);
4359 __ b(lt, false_label); 4369 __ b(lt, false_label);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
4510 ASSERT(osr_pc_offset_ == -1); 4520 ASSERT(osr_pc_offset_ == -1);
4511 osr_pc_offset_ = masm()->pc_offset(); 4521 osr_pc_offset_ = masm()->pc_offset();
4512 } 4522 }
4513 4523
4514 4524
4515 4525
4516 4526
4517 #undef __ 4527 #undef __
4518 4528
4519 } } // namespace v8::internal 4529 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698