Chromium Code Reviews

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: ia32, arm and arm64 ports. Misc cleanups. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 4910 matching lines...)
4921 __ cmp(eax, isolate()->factory()->true_value()); 4921 __ cmp(eax, isolate()->factory()->true_value());
4922 __ j(equal, if_true); 4922 __ j(equal, if_true);
4923 __ cmp(eax, isolate()->factory()->false_value()); 4923 __ cmp(eax, isolate()->factory()->false_value());
4924 Split(equal, if_true, if_false, fall_through); 4924 Split(equal, if_true, if_false, fall_through);
4925 } else if (String::Equals(check, factory->undefined_string())) { 4925 } else if (String::Equals(check, factory->undefined_string())) {
4926 __ cmp(eax, isolate()->factory()->undefined_value()); 4926 __ cmp(eax, isolate()->factory()->undefined_value());
4927 __ j(equal, if_true); 4927 __ j(equal, if_true);
4928 __ JumpIfSmi(eax, if_false); 4928 __ JumpIfSmi(eax, if_false);
4929 // Check for undetectable objects => true. 4929 // Check for undetectable objects => true.
4930 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); 4930 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset));
4931 __ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset)); 4931 __ test_b(FieldOperand(edx, Map::kBitFieldOffset),
4932 __ test(ecx, Immediate(1 << Map::kIsUndetectable)); 4932 1 << Map::kIsUndetectable);
4933 Split(not_zero, if_true, if_false, fall_through); 4933 Split(not_zero, if_true, if_false, fall_through);
4934 } else if (String::Equals(check, factory->function_string())) { 4934 } else if (String::Equals(check, factory->function_string())) {
4935 __ JumpIfSmi(eax, if_false); 4935 __ JumpIfSmi(eax, if_false);
4936 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); 4936 // Check for callable and not undetectable objects => true.
4937 __ CmpObjectType(eax, JS_FUNCTION_TYPE, edx); 4937 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset));
4938 __ j(equal, if_true); 4938 __ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset));
4939 __ CmpInstanceType(edx, JS_FUNCTION_PROXY_TYPE); 4939 __ and_(ecx, (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable));
4940 __ cmp(ecx, 1 << Map::kIsCallable);
4940 Split(equal, if_true, if_false, fall_through); 4941 Split(equal, if_true, if_false, fall_through);
4941 } else if (String::Equals(check, factory->object_string())) { 4942 } else if (String::Equals(check, factory->object_string())) {
4942 __ JumpIfSmi(eax, if_false); 4943 __ JumpIfSmi(eax, if_false);
4943 __ cmp(eax, isolate()->factory()->null_value()); 4944 __ cmp(eax, isolate()->factory()->null_value());
4944 __ j(equal, if_true); 4945 __ j(equal, if_true);
4945 __ CmpObjectType(eax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, edx); 4946 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
4947 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, edx);
4946 __ j(below, if_false); 4948 __ j(below, if_false);
4947 __ CmpInstanceType(edx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); 4949 // Check for callable or undetectable objects => false.
4948 __ j(above, if_false);
4949 // Check for undetectable objects => false.
4950 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), 4950 __ test_b(FieldOperand(edx, Map::kBitFieldOffset),
4951 1 << Map::kIsUndetectable); 4951 (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable));
4952 Split(zero, if_true, if_false, fall_through); 4952 Split(zero, if_true, if_false, fall_through);
4953 // clang-format off 4953 // clang-format off
4954 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ 4954 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
4955 } else if (String::Equals(check, factory->type##_string())) { \ 4955 } else if (String::Equals(check, factory->type##_string())) { \
4956 __ JumpIfSmi(eax, if_false); \ 4956 __ JumpIfSmi(eax, if_false); \
4957 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), \ 4957 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), \
4958 isolate()->factory()->type##_map()); \ 4958 isolate()->factory()->type##_map()); \
4959 Split(equal, if_true, if_false, fall_through); 4959 Split(equal, if_true, if_false, fall_through);
4960 SIMD128_TYPES(SIMD128_TYPE) 4960 SIMD128_TYPES(SIMD128_TYPE)
4961 #undef SIMD128_TYPE 4961 #undef SIMD128_TYPE
(...skipping 293 matching lines...)
5255 Assembler::target_address_at(call_target_address, 5255 Assembler::target_address_at(call_target_address,
5256 unoptimized_code)); 5256 unoptimized_code));
5257 return OSR_AFTER_STACK_CHECK; 5257 return OSR_AFTER_STACK_CHECK;
5258 } 5258 }
5259 5259
5260 5260
5261 } // namespace internal 5261 } // namespace internal
5262 } // namespace v8 5262 } // namespace v8
5263 5263
5264 #endif // V8_TARGET_ARCH_IA32 5264 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine