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

Side by Side Diff: src/objects-inl.h

Issue 1360403002: Revert of [es6] Introduce spec compliant IsConstructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/objects.cc ('k') | src/parser.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 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 bool Object::IsUniqueName() const { 185 bool Object::IsUniqueName() const {
186 return IsInternalizedString() || IsSymbol(); 186 return IsInternalizedString() || IsSymbol();
187 } 187 }
188 188
189 189
190 bool Object::IsCallable() const { 190 bool Object::IsCallable() const {
191 return Object::IsHeapObject() && HeapObject::cast(this)->map()->is_callable(); 191 return Object::IsHeapObject() && HeapObject::cast(this)->map()->is_callable();
192 } 192 }
193 193
194 194
195 bool Object::IsConstructor() const {
196 return Object::IsHeapObject() &&
197 HeapObject::cast(this)->map()->is_constructor();
198 }
199
200
201 bool Object::IsSpecObject() const { 195 bool Object::IsSpecObject() const {
202 return Object::IsHeapObject() 196 return Object::IsHeapObject()
203 && HeapObject::cast(this)->map()->instance_type() >= FIRST_SPEC_OBJECT_TYPE; 197 && HeapObject::cast(this)->map()->instance_type() >= FIRST_SPEC_OBJECT_TYPE;
204 } 198 }
205 199
206 200
207 bool Object::IsTemplateInfo() const { 201 bool Object::IsTemplateInfo() const {
208 return IsObjectTemplateInfo() || IsFunctionTemplateInfo(); 202 return IsObjectTemplateInfo() || IsFunctionTemplateInfo();
209 } 203 }
210 204
(...skipping 4320 matching lines...) Expand 10 before | Expand all | Expand 10 after
4531 set_bit_field(bit_field() & ~(1 << kHasNonInstancePrototype)); 4525 set_bit_field(bit_field() & ~(1 << kHasNonInstancePrototype));
4532 } 4526 }
4533 } 4527 }
4534 4528
4535 4529
4536 bool Map::has_non_instance_prototype() { 4530 bool Map::has_non_instance_prototype() {
4537 return ((1 << kHasNonInstancePrototype) & bit_field()) != 0; 4531 return ((1 << kHasNonInstancePrototype) & bit_field()) != 0;
4538 } 4532 }
4539 4533
4540 4534
4541 void Map::set_is_constructor(bool value) { 4535 void Map::set_function_with_prototype(bool value) {
4542 if (value) { 4536 set_bit_field(FunctionWithPrototype::update(bit_field(), value));
4543 set_bit_field(bit_field() | (1 << kIsConstructor));
4544 } else {
4545 set_bit_field(bit_field() & ~(1 << kIsConstructor));
4546 }
4547 } 4537 }
4548 4538
4549 4539
4550 bool Map::is_constructor() const { 4540 bool Map::function_with_prototype() {
4551 return ((1 << kIsConstructor) & bit_field()) != 0; 4541 return FunctionWithPrototype::decode(bit_field());
4552 } 4542 }
4553 4543
4554 4544
4555 void Map::set_is_hidden_prototype() { 4545 void Map::set_is_hidden_prototype() {
4556 set_bit_field3(IsHiddenPrototype::update(bit_field3(), true)); 4546 set_bit_field3(IsHiddenPrototype::update(bit_field3(), true));
4557 } 4547 }
4558 4548
4559 4549
4560 bool Map::is_hidden_prototype() const { 4550 bool Map::is_hidden_prototype() const {
4561 return IsHiddenPrototype::decode(bit_field3()); 4551 return IsHiddenPrototype::decode(bit_field3());
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
4798 4788
4799 bool Map::IsPrimitiveMap() { 4789 bool Map::IsPrimitiveMap() {
4800 STATIC_ASSERT(FIRST_PRIMITIVE_TYPE == FIRST_TYPE); 4790 STATIC_ASSERT(FIRST_PRIMITIVE_TYPE == FIRST_TYPE);
4801 return instance_type() <= LAST_PRIMITIVE_TYPE; 4791 return instance_type() <= LAST_PRIMITIVE_TYPE;
4802 } 4792 }
4803 bool Map::IsJSObjectMap() { 4793 bool Map::IsJSObjectMap() {
4804 STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE); 4794 STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE);
4805 return instance_type() >= FIRST_JS_OBJECT_TYPE; 4795 return instance_type() >= FIRST_JS_OBJECT_TYPE;
4806 } 4796 }
4807 bool Map::IsJSArrayMap() { return instance_type() == JS_ARRAY_TYPE; } 4797 bool Map::IsJSArrayMap() { return instance_type() == JS_ARRAY_TYPE; }
4808 bool Map::IsJSFunctionMap() { return instance_type() == JS_FUNCTION_TYPE; }
4809 bool Map::IsStringMap() { return instance_type() < FIRST_NONSTRING_TYPE; } 4798 bool Map::IsStringMap() { return instance_type() < FIRST_NONSTRING_TYPE; }
4810 bool Map::IsJSProxyMap() { 4799 bool Map::IsJSProxyMap() {
4811 InstanceType type = instance_type(); 4800 InstanceType type = instance_type();
4812 return FIRST_JS_PROXY_TYPE <= type && type <= LAST_JS_PROXY_TYPE; 4801 return FIRST_JS_PROXY_TYPE <= type && type <= LAST_JS_PROXY_TYPE;
4813 } 4802 }
4814 bool Map::IsJSGlobalProxyMap() { 4803 bool Map::IsJSGlobalProxyMap() {
4815 return instance_type() == JS_GLOBAL_PROXY_TYPE; 4804 return instance_type() == JS_GLOBAL_PROXY_TYPE;
4816 } 4805 }
4817 bool Map::IsJSGlobalObjectMap() { 4806 bool Map::IsJSGlobalObjectMap() {
4818 return instance_type() == JS_GLOBAL_OBJECT_TYPE; 4807 return instance_type() == JS_GLOBAL_OBJECT_TYPE;
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
6260 if (map()->has_non_instance_prototype()) { 6249 if (map()->has_non_instance_prototype()) {
6261 Object* prototype = map()->GetConstructor(); 6250 Object* prototype = map()->GetConstructor();
6262 // The map must have a prototype in that field, not a back pointer. 6251 // The map must have a prototype in that field, not a back pointer.
6263 DCHECK(!prototype->IsMap()); 6252 DCHECK(!prototype->IsMap());
6264 return prototype; 6253 return prototype;
6265 } 6254 }
6266 return instance_prototype(); 6255 return instance_prototype();
6267 } 6256 }
6268 6257
6269 6258
6259 bool JSFunction::should_have_prototype() {
6260 return map()->function_with_prototype();
6261 }
6262
6263
6270 bool JSFunction::is_compiled() { 6264 bool JSFunction::is_compiled() {
6271 Builtins* builtins = GetIsolate()->builtins(); 6265 Builtins* builtins = GetIsolate()->builtins();
6272 return code() != builtins->builtin(Builtins::kCompileLazy) && 6266 return code() != builtins->builtin(Builtins::kCompileLazy) &&
6273 code() != builtins->builtin(Builtins::kCompileOptimized) && 6267 code() != builtins->builtin(Builtins::kCompileOptimized) &&
6274 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); 6268 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent);
6275 } 6269 }
6276 6270
6277 6271
6278 bool JSFunction::has_simple_parameters() { 6272 bool JSFunction::has_simple_parameters() {
6279 return shared()->has_simple_parameters(); 6273 return shared()->has_simple_parameters();
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
8013 #undef READ_INT64_FIELD 8007 #undef READ_INT64_FIELD
8014 #undef WRITE_INT64_FIELD 8008 #undef WRITE_INT64_FIELD
8015 #undef READ_BYTE_FIELD 8009 #undef READ_BYTE_FIELD
8016 #undef WRITE_BYTE_FIELD 8010 #undef WRITE_BYTE_FIELD
8017 #undef NOBARRIER_READ_BYTE_FIELD 8011 #undef NOBARRIER_READ_BYTE_FIELD
8018 #undef NOBARRIER_WRITE_BYTE_FIELD 8012 #undef NOBARRIER_WRITE_BYTE_FIELD
8019 8013
8020 } } // namespace v8::internal 8014 } } // namespace v8::internal
8021 8015
8022 #endif // V8_OBJECTS_INL_H_ 8016 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698