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

Side by Side Diff: src/x64/lithium-codegen-x64.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
« no previous file with comments | « src/weak-collection.js ('k') | test/cctest/test-api.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_X64 5 #if V8_TARGET_ARCH_X64
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/cpu-profiler.h" 10 #include "src/cpu-profiler.h"
(...skipping 5599 matching lines...) Expand 10 before | Expand all | Expand 10 after
5610 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); 5610 __ CompareRoot(input, Heap::kUndefinedValueRootIndex);
5611 __ j(equal, true_label, true_distance); 5611 __ j(equal, true_label, true_distance);
5612 __ JumpIfSmi(input, false_label, false_distance); 5612 __ JumpIfSmi(input, false_label, false_distance);
5613 // Check for undetectable objects => true. 5613 // Check for undetectable objects => true.
5614 __ movp(input, FieldOperand(input, HeapObject::kMapOffset)); 5614 __ movp(input, FieldOperand(input, HeapObject::kMapOffset));
5615 __ testb(FieldOperand(input, Map::kBitFieldOffset), 5615 __ testb(FieldOperand(input, Map::kBitFieldOffset),
5616 Immediate(1 << Map::kIsUndetectable)); 5616 Immediate(1 << Map::kIsUndetectable));
5617 final_branch_condition = not_zero; 5617 final_branch_condition = not_zero;
5618 5618
5619 } else if (String::Equals(type_name, factory->function_string())) { 5619 } else if (String::Equals(type_name, factory->function_string())) {
5620 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
5621 __ JumpIfSmi(input, false_label, false_distance); 5620 __ JumpIfSmi(input, false_label, false_distance);
5622 __ CmpObjectType(input, JS_FUNCTION_TYPE, input); 5621 // Check for callable and not undetectable objects => true.
5623 __ j(equal, true_label, true_distance); 5622 __ movp(input, FieldOperand(input, HeapObject::kMapOffset));
5624 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE); 5623 __ movzxbl(input, FieldOperand(input, Map::kBitFieldOffset));
5624 __ andb(input,
5625 Immediate((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable)));
5626 __ cmpb(input, Immediate(1 << Map::kIsCallable));
5625 final_branch_condition = equal; 5627 final_branch_condition = equal;
5626 5628
5627 } else if (String::Equals(type_name, factory->object_string())) { 5629 } else if (String::Equals(type_name, factory->object_string())) {
5628 __ JumpIfSmi(input, false_label, false_distance); 5630 __ JumpIfSmi(input, false_label, false_distance);
5629 __ CompareRoot(input, Heap::kNullValueRootIndex); 5631 __ CompareRoot(input, Heap::kNullValueRootIndex);
5630 __ j(equal, true_label, true_distance); 5632 __ j(equal, true_label, true_distance);
5631 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); 5633 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
5634 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, input);
5632 __ j(below, false_label, false_distance); 5635 __ j(below, false_label, false_distance);
5633 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); 5636 // Check for callable or undetectable objects => false.
5634 __ j(above, false_label, false_distance);
5635 // Check for undetectable objects => false.
5636 __ testb(FieldOperand(input, Map::kBitFieldOffset), 5637 __ testb(FieldOperand(input, Map::kBitFieldOffset),
5637 Immediate(1 << Map::kIsUndetectable)); 5638 Immediate((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable)));
5638 final_branch_condition = zero; 5639 final_branch_condition = zero;
5639 5640
5640 // clang-format off 5641 // clang-format off
5641 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ 5642 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
5642 } else if (String::Equals(type_name, factory->type##_string())) { \ 5643 } else if (String::Equals(type_name, factory->type##_string())) { \
5643 __ JumpIfSmi(input, false_label, false_distance); \ 5644 __ JumpIfSmi(input, false_label, false_distance); \
5644 __ movp(input, FieldOperand(input, HeapObject::kMapOffset)); \ 5645 __ CompareRoot(FieldOperand(input, HeapObject::kMapOffset), \
5645 __ CompareRoot(input, Heap::k##Type##MapRootIndex); \ 5646 Heap::k##Type##MapRootIndex); \
5646 final_branch_condition = equal; 5647 final_branch_condition = equal;
5647 SIMD128_TYPES(SIMD128_TYPE) 5648 SIMD128_TYPES(SIMD128_TYPE)
5648 #undef SIMD128_TYPE 5649 #undef SIMD128_TYPE
5649 // clang-format on 5650 // clang-format on
5650 5651
5651 } else { 5652 } else {
5652 __ jmp(false_label, false_distance); 5653 __ jmp(false_label, false_distance);
5653 } 5654 }
5654 5655
5655 return final_branch_condition; 5656 return final_branch_condition;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
5945 RecordSafepoint(Safepoint::kNoLazyDeopt); 5946 RecordSafepoint(Safepoint::kNoLazyDeopt);
5946 } 5947 }
5947 5948
5948 5949
5949 #undef __ 5950 #undef __
5950 5951
5951 } // namespace internal 5952 } // namespace internal
5952 } // namespace v8 5953 } // namespace v8
5953 5954
5954 #endif // V8_TARGET_ARCH_X64 5955 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/weak-collection.js ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698