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-typer.h" | 7 #include "src/asmjs/asm-typer.h" |
8 #include "src/asmjs/asm-wasm-builder.h" | 8 #include "src/asmjs/asm-wasm-builder.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 if (!context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) { | 539 if (!context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) { |
540 // TODO(titzer): Move this to bootstrapper.cc?? | 540 // TODO(titzer): Move this to bootstrapper.cc?? |
541 // TODO(titzer): Also make one for strict mode functions? | 541 // TODO(titzer): Also make one for strict mode functions? |
542 Handle<Map> prev_map = Handle<Map>(context->sloppy_function_map(), isolate); | 542 Handle<Map> prev_map = Handle<Map>(context->sloppy_function_map(), isolate); |
543 | 543 |
544 InstanceType instance_type = prev_map->instance_type(); | 544 InstanceType instance_type = prev_map->instance_type(); |
545 int internal_fields = JSObject::GetInternalFieldCount(*prev_map); | 545 int internal_fields = JSObject::GetInternalFieldCount(*prev_map); |
546 CHECK_EQ(0, internal_fields); | 546 CHECK_EQ(0, internal_fields); |
547 int pre_allocated = | 547 int pre_allocated = |
548 prev_map->GetInObjectProperties() - prev_map->unused_property_fields(); | 548 prev_map->GetInObjectProperties() - prev_map->unused_property_fields(); |
549 int instance_size; | 549 int instance_size = 0; |
550 int in_object_properties; | 550 int in_object_properties = 0; |
551 JSFunction::CalculateInstanceSizeHelper(instance_type, internal_fields + 1, | 551 int wasm_internal_fields = internal_fields + 1 // module instance object |
| 552 + 1 // function arity |
| 553 + 1; // function signature |
| 554 JSFunction::CalculateInstanceSizeHelper(instance_type, wasm_internal_fields, |
552 0, &instance_size, | 555 0, &instance_size, |
553 &in_object_properties); | 556 &in_object_properties); |
554 | 557 |
555 int unused_property_fields = in_object_properties - pre_allocated; | 558 int unused_property_fields = in_object_properties - pre_allocated; |
556 Handle<Map> map = Map::CopyInitialMap( | 559 Handle<Map> map = Map::CopyInitialMap( |
557 prev_map, instance_size, in_object_properties, unused_property_fields); | 560 prev_map, instance_size, in_object_properties, unused_property_fields); |
558 | 561 |
559 context->set_wasm_function_map(*map); | 562 context->set_wasm_function_map(*map); |
560 } | 563 } |
561 } | 564 } |
562 | 565 |
563 } // namespace internal | 566 } // namespace internal |
564 } // namespace v8 | 567 } // namespace v8 |
OLD | NEW |