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/api-natives.h" | 5 #include "src/api-natives.h" |
6 #include "src/api.h" | 6 #include "src/api.h" |
7 #include "src/asmjs/asm-js.h" | 7 #include "src/asmjs/asm-js.h" |
8 #include "src/asmjs/asm-typer.h" | 8 #include "src/asmjs/asm-typer.h" |
9 #include "src/asmjs/asm-wasm-builder.h" | 9 #include "src/asmjs/asm-wasm-builder.h" |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 Handle<Context> context(global->native_context(), isolate); | 764 Handle<Context> context(global->native_context(), isolate); |
765 // TODO(titzer): once FLAG_expose_wasm is gone, this should become a DCHECK. | 765 // TODO(titzer): once FLAG_expose_wasm is gone, this should become a DCHECK. |
766 if (context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) return; | 766 if (context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) return; |
767 | 767 |
768 // Install Maps. | 768 // Install Maps. |
769 | 769 |
770 // TODO(titzer): Also make one for strict mode functions? | 770 // TODO(titzer): Also make one for strict mode functions? |
771 Handle<Map> prev_map = Handle<Map>(context->sloppy_function_map(), isolate); | 771 Handle<Map> prev_map = Handle<Map>(context->sloppy_function_map(), isolate); |
772 | 772 |
773 InstanceType instance_type = prev_map->instance_type(); | 773 InstanceType instance_type = prev_map->instance_type(); |
774 int internal_fields = JSObject::GetInternalFieldCount(*prev_map); | 774 int embedder_fields = JSObject::GetEmbedderFieldCount(*prev_map); |
775 CHECK_EQ(0, internal_fields); | 775 CHECK_EQ(0, embedder_fields); |
776 int pre_allocated = | 776 int pre_allocated = |
777 prev_map->GetInObjectProperties() - prev_map->unused_property_fields(); | 777 prev_map->GetInObjectProperties() - prev_map->unused_property_fields(); |
778 int instance_size = 0; | 778 int instance_size = 0; |
779 int in_object_properties = 0; | 779 int in_object_properties = 0; |
780 int wasm_internal_fields = internal_fields + 1 // module instance object | 780 int wasm_embedder_fields = embedder_fields + 1 // module instance object |
781 + 1 // function arity | 781 + 1 // function arity |
782 + 1; // function signature | 782 + 1; // function signature |
783 JSFunction::CalculateInstanceSizeHelper(instance_type, wasm_internal_fields, | 783 JSFunction::CalculateInstanceSizeHelper(instance_type, wasm_embedder_fields, |
784 0, &instance_size, | 784 0, &instance_size, |
785 &in_object_properties); | 785 &in_object_properties); |
786 | 786 |
787 int unused_property_fields = in_object_properties - pre_allocated; | 787 int unused_property_fields = in_object_properties - pre_allocated; |
788 Handle<Map> map = Map::CopyInitialMap( | 788 Handle<Map> map = Map::CopyInitialMap( |
789 prev_map, instance_size, in_object_properties, unused_property_fields); | 789 prev_map, instance_size, in_object_properties, unused_property_fields); |
790 | 790 |
791 context->set_wasm_function_map(*map); | 791 context->set_wasm_function_map(*map); |
792 | 792 |
793 // Install symbols. | 793 // Install symbols. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); | 918 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); |
919 return HasBrand(value, symbol); | 919 return HasBrand(value, symbol); |
920 } | 920 } |
921 | 921 |
922 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { | 922 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { |
923 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); | 923 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); |
924 return HasBrand(value, symbol); | 924 return HasBrand(value, symbol); |
925 } | 925 } |
926 } // namespace internal | 926 } // namespace internal |
927 } // namespace v8 | 927 } // namespace v8 |
OLD | NEW |