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

Side by Side Diff: src/full-codegen/ia32/full-codegen-ia32.cc

Issue 1316933002: [es6] Initial steps towards a correct implementation of IsCallable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase again. Created 5 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
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 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 4886 matching lines...) Expand 10 before | Expand all | Expand 10 after
4897 __ cmp(eax, isolate()->factory()->true_value()); 4897 __ cmp(eax, isolate()->factory()->true_value());
4898 __ j(equal, if_true); 4898 __ j(equal, if_true);
4899 __ cmp(eax, isolate()->factory()->false_value()); 4899 __ cmp(eax, isolate()->factory()->false_value());
4900 Split(equal, if_true, if_false, fall_through); 4900 Split(equal, if_true, if_false, fall_through);
4901 } else if (String::Equals(check, factory->undefined_string())) { 4901 } else if (String::Equals(check, factory->undefined_string())) {
4902 __ cmp(eax, isolate()->factory()->undefined_value()); 4902 __ cmp(eax, isolate()->factory()->undefined_value());
4903 __ j(equal, if_true); 4903 __ j(equal, if_true);
4904 __ JumpIfSmi(eax, if_false); 4904 __ JumpIfSmi(eax, if_false);
4905 // Check for undetectable objects => true. 4905 // Check for undetectable objects => true.
4906 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); 4906 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset));
4907 __ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset)); 4907 __ test_b(FieldOperand(edx, Map::kBitFieldOffset),
4908 __ test(ecx, Immediate(1 << Map::kIsUndetectable)); 4908 1 << Map::kIsUndetectable);
4909 Split(not_zero, if_true, if_false, fall_through); 4909 Split(not_zero, if_true, if_false, fall_through);
4910 } else if (String::Equals(check, factory->function_string())) { 4910 } else if (String::Equals(check, factory->function_string())) {
4911 __ JumpIfSmi(eax, if_false); 4911 __ JumpIfSmi(eax, if_false);
4912 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); 4912 // Check for callable and not undetectable objects => true.
4913 __ CmpObjectType(eax, JS_FUNCTION_TYPE, edx); 4913 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset));
4914 __ j(equal, if_true); 4914 __ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset));
4915 __ CmpInstanceType(edx, JS_FUNCTION_PROXY_TYPE); 4915 __ and_(ecx, (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable));
4916 __ cmp(ecx, 1 << Map::kIsCallable);
4916 Split(equal, if_true, if_false, fall_through); 4917 Split(equal, if_true, if_false, fall_through);
4917 } else if (String::Equals(check, factory->object_string())) { 4918 } else if (String::Equals(check, factory->object_string())) {
4918 __ JumpIfSmi(eax, if_false); 4919 __ JumpIfSmi(eax, if_false);
4919 __ cmp(eax, isolate()->factory()->null_value()); 4920 __ cmp(eax, isolate()->factory()->null_value());
4920 __ j(equal, if_true); 4921 __ j(equal, if_true);
4921 __ CmpObjectType(eax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, edx); 4922 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
4923 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, edx);
4922 __ j(below, if_false); 4924 __ j(below, if_false);
4923 __ CmpInstanceType(edx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); 4925 // Check for callable or undetectable objects => false.
4924 __ j(above, if_false);
4925 // Check for undetectable objects => false.
4926 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), 4926 __ test_b(FieldOperand(edx, Map::kBitFieldOffset),
4927 1 << Map::kIsUndetectable); 4927 (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable));
4928 Split(zero, if_true, if_false, fall_through); 4928 Split(zero, if_true, if_false, fall_through);
4929 // clang-format off 4929 // clang-format off
4930 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ 4930 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
4931 } else if (String::Equals(check, factory->type##_string())) { \ 4931 } else if (String::Equals(check, factory->type##_string())) { \
4932 __ JumpIfSmi(eax, if_false); \ 4932 __ JumpIfSmi(eax, if_false); \
4933 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), \ 4933 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), \
4934 isolate()->factory()->type##_map()); \ 4934 isolate()->factory()->type##_map()); \
4935 Split(equal, if_true, if_false, fall_through); 4935 Split(equal, if_true, if_false, fall_through);
4936 SIMD128_TYPES(SIMD128_TYPE) 4936 SIMD128_TYPES(SIMD128_TYPE)
4937 #undef SIMD128_TYPE 4937 #undef SIMD128_TYPE
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
5231 Assembler::target_address_at(call_target_address, 5231 Assembler::target_address_at(call_target_address,
5232 unoptimized_code)); 5232 unoptimized_code));
5233 return OSR_AFTER_STACK_CHECK; 5233 return OSR_AFTER_STACK_CHECK;
5234 } 5234 }
5235 5235
5236 5236
5237 } // namespace internal 5237 } // namespace internal
5238 } // namespace v8 5238 } // namespace v8
5239 5239
5240 #endif // V8_TARGET_ARCH_IA32 5240 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/arm64/full-codegen-arm64.cc ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698