OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 15839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15850 } | 15850 } |
15851 | 15851 |
15852 bool FixedArrayBase::IsCowArray() const { | 15852 bool FixedArrayBase::IsCowArray() const { |
15853 return map() == GetHeap()->fixed_cow_array_map(); | 15853 return map() == GetHeap()->fixed_cow_array_map(); |
15854 } | 15854 } |
15855 | 15855 |
15856 bool JSObject::WasConstructedFromApiFunction() { | 15856 bool JSObject::WasConstructedFromApiFunction() { |
15857 auto instance_type = map()->instance_type(); | 15857 auto instance_type = map()->instance_type(); |
15858 bool is_api_object = instance_type == JS_API_OBJECT_TYPE || | 15858 bool is_api_object = instance_type == JS_API_OBJECT_TYPE || |
15859 instance_type == JS_SPECIAL_API_OBJECT_TYPE; | 15859 instance_type == JS_SPECIAL_API_OBJECT_TYPE; |
15860 bool is_wasm_object = | |
15861 instance_type == WASM_MEMORY_TYPE || instance_type == WASM_MODULE_TYPE || | |
15862 instance_type == WASM_INSTANCE_TYPE || instance_type == WASM_TABLE_TYPE; | |
15860 #ifdef ENABLE_SLOW_DCHECKS | 15863 #ifdef ENABLE_SLOW_DCHECKS |
15861 if (FLAG_enable_slow_asserts) { | 15864 if (FLAG_enable_slow_asserts) { |
15862 Object* maybe_constructor = map()->GetConstructor(); | 15865 Object* maybe_constructor = map()->GetConstructor(); |
15863 if (maybe_constructor->IsJSFunction()) { | 15866 if (maybe_constructor->IsJSFunction()) { |
15864 JSFunction* constructor = JSFunction::cast(maybe_constructor); | 15867 JSFunction* constructor = JSFunction::cast(maybe_constructor); |
15865 if (constructor->shared()->IsApiFunction()) { | 15868 DCHECK_EQ(constructor->shared()->IsApiFunction(), |
15866 DCHECK(is_api_object); | 15869 is_api_object || is_wasm_object); |
15867 } else { | |
15868 DCHECK(!is_api_object); | |
15869 } | |
15870 } else if (maybe_constructor->IsFunctionTemplateInfo()) { | 15870 } else if (maybe_constructor->IsFunctionTemplateInfo()) { |
15871 DCHECK(is_api_object); | 15871 DCHECK(is_api_object || is_wasm_object); |
15872 } else { | 15872 } else { |
15873 return false; | 15873 return false; |
15874 } | 15874 } |
15875 } | 15875 } |
15876 #endif | 15876 #endif |
15877 // TODO(titzer): Clean this up somehow. WebAssembly objects should not be | |
15878 // considered "constructed from API functions" even though they have | |
15879 // function template info, since that would make the V8 GC identify them to | |
ahaas
2017/07/10 12:42:48
What do you mean by the "would" here? Does it make
titzer
2017/07/10 13:16:46
Without this change, the V8 GC (correctly) does no
| |
15880 // the embedder, e.g. the Oilpan GC. | |
15877 return is_api_object; | 15881 return is_api_object; |
15878 } | 15882 } |
15879 | 15883 |
15880 const char* Symbol::PrivateSymbolToName() const { | 15884 const char* Symbol::PrivateSymbolToName() const { |
15881 Heap* heap = GetIsolate()->heap(); | 15885 Heap* heap = GetIsolate()->heap(); |
15882 #define SYMBOL_CHECK_AND_PRINT(name) \ | 15886 #define SYMBOL_CHECK_AND_PRINT(name) \ |
15883 if (this == heap->name()) return #name; | 15887 if (this == heap->name()) return #name; |
15884 PRIVATE_SYMBOL_LIST(SYMBOL_CHECK_AND_PRINT) | 15888 PRIVATE_SYMBOL_LIST(SYMBOL_CHECK_AND_PRINT) |
15885 #undef SYMBOL_CHECK_AND_PRINT | 15889 #undef SYMBOL_CHECK_AND_PRINT |
15886 return "UNKNOWN"; | 15890 return "UNKNOWN"; |
(...skipping 4326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
20213 // not | 20217 // not |
20214 // depend on this. | 20218 // depend on this. |
20215 return DICTIONARY_ELEMENTS; | 20219 return DICTIONARY_ELEMENTS; |
20216 } | 20220 } |
20217 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20221 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20218 return kind; | 20222 return kind; |
20219 } | 20223 } |
20220 } | 20224 } |
20221 } // namespace internal | 20225 } // namespace internal |
20222 } // namespace v8 | 20226 } // namespace v8 |
OLD | NEW |