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

Side by Side Diff: src/ia32/lithium-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. 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/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 5403 matching lines...) Expand 10 before | Expand all | Expand 10 after
5414 __ cmp(input, factory()->undefined_value()); 5414 __ cmp(input, factory()->undefined_value());
5415 __ j(equal, true_label, true_distance); 5415 __ j(equal, true_label, true_distance);
5416 __ JumpIfSmi(input, false_label, false_distance); 5416 __ JumpIfSmi(input, false_label, false_distance);
5417 // Check for undetectable objects => true. 5417 // Check for undetectable objects => true.
5418 __ mov(input, FieldOperand(input, HeapObject::kMapOffset)); 5418 __ mov(input, FieldOperand(input, HeapObject::kMapOffset));
5419 __ test_b(FieldOperand(input, Map::kBitFieldOffset), 5419 __ test_b(FieldOperand(input, Map::kBitFieldOffset),
5420 1 << Map::kIsUndetectable); 5420 1 << Map::kIsUndetectable);
5421 final_branch_condition = not_zero; 5421 final_branch_condition = not_zero;
5422 5422
5423 } else if (String::Equals(type_name, factory()->function_string())) { 5423 } else if (String::Equals(type_name, factory()->function_string())) {
5424 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
5425 __ JumpIfSmi(input, false_label, false_distance); 5424 __ JumpIfSmi(input, false_label, false_distance);
5426 __ CmpObjectType(input, JS_FUNCTION_TYPE, input); 5425 // Check for callable and not undetectable objects => true.
5427 __ j(equal, true_label, true_distance); 5426 __ mov(input, FieldOperand(input, HeapObject::kMapOffset));
5428 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE); 5427 __ movzx_b(input, FieldOperand(input, Map::kBitFieldOffset));
5428 __ and_(input, (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable));
5429 __ cmp(input, 1 << Map::kIsCallable);
5429 final_branch_condition = equal; 5430 final_branch_condition = equal;
5430 5431
5431 } else if (String::Equals(type_name, factory()->object_string())) { 5432 } else if (String::Equals(type_name, factory()->object_string())) {
5432 __ JumpIfSmi(input, false_label, false_distance); 5433 __ JumpIfSmi(input, false_label, false_distance);
5433 __ cmp(input, factory()->null_value()); 5434 __ cmp(input, factory()->null_value());
5434 __ j(equal, true_label, true_distance); 5435 __ j(equal, true_label, true_distance);
5435 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); 5436 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
5437 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, input);
5436 __ j(below, false_label, false_distance); 5438 __ j(below, false_label, false_distance);
5437 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); 5439 // Check for callable or undetectable objects => false.
5438 __ j(above, false_label, false_distance);
5439 // Check for undetectable objects => false.
5440 __ test_b(FieldOperand(input, Map::kBitFieldOffset), 5440 __ test_b(FieldOperand(input, Map::kBitFieldOffset),
5441 1 << Map::kIsUndetectable); 5441 (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable));
5442 final_branch_condition = zero; 5442 final_branch_condition = zero;
5443 5443
5444 // clang-format off 5444 // clang-format off
5445 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ 5445 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
5446 } else if (String::Equals(type_name, factory()->type##_string())) { \ 5446 } else if (String::Equals(type_name, factory()->type##_string())) { \
5447 __ JumpIfSmi(input, false_label, false_distance); \ 5447 __ JumpIfSmi(input, false_label, false_distance); \
5448 __ cmp(FieldOperand(input, HeapObject::kMapOffset), \ 5448 __ cmp(FieldOperand(input, HeapObject::kMapOffset), \
5449 factory()->type##_map()); \ 5449 factory()->type##_map()); \
5450 final_branch_condition = equal; 5450 final_branch_condition = equal;
5451 SIMD128_TYPES(SIMD128_TYPE) 5451 SIMD128_TYPES(SIMD128_TYPE)
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
5750 RecordSafepoint(Safepoint::kNoLazyDeopt); 5750 RecordSafepoint(Safepoint::kNoLazyDeopt);
5751 } 5751 }
5752 5752
5753 5753
5754 #undef __ 5754 #undef __
5755 5755
5756 } // namespace internal 5756 } // namespace internal
5757 } // namespace v8 5757 } // namespace v8
5758 5758
5759 #endif // V8_TARGET_ARCH_IA32 5759 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698