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

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: 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
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 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 Label* is_false, 1912 Label* is_false,
1913 Handle<String>class_name, 1913 Handle<String>class_name,
1914 Register input, 1914 Register input,
1915 Register temp, 1915 Register temp,
1916 Register temp2) { 1916 Register temp2) {
1917 ASSERT(!input.is(temp)); 1917 ASSERT(!input.is(temp));
1918 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register. 1918 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register.
1919 __ JumpIfSmi(input, is_false); 1919 __ JumpIfSmi(input, is_false);
1920 __ CompareObjectType(input, temp, temp2, FIRST_SPEC_OBJECT_TYPE); 1920 __ CompareObjectType(input, temp, temp2, FIRST_SPEC_OBJECT_TYPE);
1921 __ b(lt, is_false); 1921 __ b(lt, is_false);
1922 ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
Kevin Millikin (Chromium) 2011/09/07 10:13:12 This could be a static assert?
rossberg 2011/09/07 14:57:31 Done.
1922 1923
1923 // Map is now in temp. 1924 // Assuming the following assertions, we can do the same test for
1925 // either "Object" or "Function", only the branch conditions differ.
1926 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
1927 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE ==
1928 FIRST_SPEC_OBJECT_TYPE + 1);
1929 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE ==
1930 LAST_SPEC_OBJECT_TYPE - 1);
1931
1932 // Map is now in temp, type in temp2.
1924 // Functions have class 'Function'. 1933 // Functions have class 'Function'.
1925 __ CompareInstanceType(temp, temp2, FIRST_CALLABLE_SPEC_OBJECT_TYPE); 1934 __ cmp(temp2, Operand(FIRST_SPEC_OBJECT_TYPE));
Kevin Millikin (Chromium) 2011/09/07 10:13:12 Aren't the flags still set from the previous compa
rossberg 2011/09/07 14:57:31 Of course. That was the whole intent of the orderi
1926 if (class_name->IsEqualTo(CStrVector("Function"))) { 1935 if (class_name->IsEqualTo(CStrVector("Function"))) {
1927 __ b(ge, is_true); 1936 __ b(eq, is_true);
1937 } else {
1938 __ b(le, is_false);
1939 }
1940 __ cmp(temp2, Operand(LAST_SPEC_OBJECT_TYPE));
1941 if (class_name->IsEqualTo(CStrVector("Function"))) {
1942 __ b(eq, is_true);
1928 } else { 1943 } else {
1929 __ b(ge, is_false); 1944 __ b(ge, is_false);
1930 } 1945 }
1931 1946
1947 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range.
1932 // Check if the constructor in the map is a function. 1948 // Check if the constructor in the map is a function.
1933 __ ldr(temp, FieldMemOperand(temp, Map::kConstructorOffset)); 1949 __ ldr(temp, FieldMemOperand(temp, Map::kConstructorOffset));
1934 1950
1935 // As long as LAST_CALLABLE_SPEC_OBJECT_TYPE is the last instance type and
1936 // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after
1937 // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter.
1938 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE);
1939 STATIC_ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE ==
1940 LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1);
1941
1942 // Objects with a non-function constructor have class 'Object'. 1951 // Objects with a non-function constructor have class 'Object'.
1943 __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE); 1952 __ CompareObjectType(temp, temp2, temp2, JS_FUNCTION_TYPE);
1944 if (class_name->IsEqualTo(CStrVector("Object"))) { 1953 if (class_name->IsEqualTo(CStrVector("Object"))) {
1945 __ b(ne, is_true); 1954 __ b(ne, is_true);
1946 } else { 1955 } else {
1947 __ b(ne, is_false); 1956 __ b(ne, is_false);
1948 } 1957 }
1949 1958
1950 // temp now contains the constructor function. Grab the 1959 // temp now contains the constructor function. Grab the
1951 // instance class name from there. 1960 // instance class name from there.
(...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after
4335 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); 4344 __ CompareRoot(input, Heap::kUndefinedValueRootIndex);
4336 __ b(eq, true_label); 4345 __ b(eq, true_label);
4337 __ JumpIfSmi(input, false_label); 4346 __ JumpIfSmi(input, false_label);
4338 // Check for undetectable objects => true. 4347 // Check for undetectable objects => true.
4339 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); 4348 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset));
4340 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); 4349 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset));
4341 __ tst(ip, Operand(1 << Map::kIsUndetectable)); 4350 __ tst(ip, Operand(1 << Map::kIsUndetectable));
4342 final_branch_condition = ne; 4351 final_branch_condition = ne;
4343 4352
4344 } 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);
4345 __ JumpIfSmi(input, false_label); 4355 __ JumpIfSmi(input, false_label);
4346 __ CompareObjectType(input, input, scratch, 4356 __ CompareObjectType(input, scratch, input, JS_FUNCTION_TYPE);
4347 FIRST_CALLABLE_SPEC_OBJECT_TYPE); 4357 __ b(eq, true_label);
4348 final_branch_condition = ge; 4358 __ cmp(input, Operand(JS_FUNCTION_PROXY_TYPE));
4359 final_branch_condition = eq;
4349 4360
4350 } else if (type_name->Equals(heap()->object_symbol())) { 4361 } else if (type_name->Equals(heap()->object_symbol())) {
4351 __ JumpIfSmi(input, false_label); 4362 __ JumpIfSmi(input, false_label);
4352 if (!FLAG_harmony_typeof) { 4363 if (!FLAG_harmony_typeof) {
4353 __ CompareRoot(input, Heap::kNullValueRootIndex); 4364 __ CompareRoot(input, Heap::kNullValueRootIndex);
4354 __ b(eq, true_label); 4365 __ b(eq, true_label);
4355 } 4366 }
4356 __ CompareObjectType(input, input, scratch, 4367 __ CompareObjectType(input, input, scratch,
4357 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); 4368 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE);
4358 __ b(lt, false_label); 4369 __ b(lt, false_label);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
4509 ASSERT(osr_pc_offset_ == -1); 4520 ASSERT(osr_pc_offset_ == -1);
4510 osr_pc_offset_ = masm()->pc_offset(); 4521 osr_pc_offset_ = masm()->pc_offset();
4511 } 4522 }
4512 4523
4513 4524
4514 4525
4515 4526
4516 #undef __ 4527 #undef __
4517 4528
4518 } } // namespace v8::internal 4529 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698