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

Side by Side Diff: src/factory.cc

Issue 2407183002: [modules] Don't unnecessarily keep function alive after evaluation. (Closed)
Patch Set: Remove stale offset. Created 4 years, 2 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/api.cc ('k') | src/objects.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 Handle<ObjectHashTable> exports = 1786 Handle<ObjectHashTable> exports =
1787 ObjectHashTable::New(isolate(), module_info->regular_exports()->length()); 1787 ObjectHashTable::New(isolate(), module_info->regular_exports()->length());
1788 int requested_modules_length = module_info->module_requests()->length(); 1788 int requested_modules_length = module_info->module_requests()->length();
1789 Handle<FixedArray> requested_modules = 1789 Handle<FixedArray> requested_modules =
1790 requested_modules_length > 0 ? NewFixedArray(requested_modules_length) 1790 requested_modules_length > 0 ? NewFixedArray(requested_modules_length)
1791 : empty_fixed_array(); 1791 : empty_fixed_array();
1792 1792
1793 Handle<Module> module = Handle<Module>::cast(NewStruct(MODULE_TYPE)); 1793 Handle<Module> module = Handle<Module>::cast(NewStruct(MODULE_TYPE));
1794 module->set_code(*code); 1794 module->set_code(*code);
1795 module->set_exports(*exports); 1795 module->set_exports(*exports);
1796 module->set_flags(0);
1797 module->set_hash(isolate()->GenerateIdentityHash(Smi::kMaxValue)); 1796 module->set_hash(isolate()->GenerateIdentityHash(Smi::kMaxValue));
1798 module->set_module_namespace(isolate()->heap()->undefined_value()); 1797 module->set_module_namespace(isolate()->heap()->undefined_value());
1799 module->set_requested_modules(*requested_modules); 1798 module->set_requested_modules(*requested_modules);
1799 DCHECK(!module->instantiated());
1800 DCHECK(!module->evaluated());
1800 return module; 1801 return module;
1801 } 1802 }
1802 1803
1803 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer(SharedFlag shared, 1804 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer(SharedFlag shared,
1804 PretenureFlag pretenure) { 1805 PretenureFlag pretenure) {
1805 Handle<JSFunction> array_buffer_fun( 1806 Handle<JSFunction> array_buffer_fun(
1806 shared == SharedFlag::kShared 1807 shared == SharedFlag::kShared
1807 ? isolate()->native_context()->shared_array_buffer_fun() 1808 ? isolate()->native_context()->shared_array_buffer_fun()
1808 : isolate()->native_context()->array_buffer_fun()); 1809 : isolate()->native_context()->array_buffer_fun());
1809 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateJSObject( 1810 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateJSObject(
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
2669 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); 2670 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map));
2670 iterator->set_initial_next(*next); 2671 iterator->set_initial_next(*next);
2671 iterator->set_array(*array); 2672 iterator->set_array(*array);
2672 iterator->set_index(0); 2673 iterator->set_index(0);
2673 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); 2674 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next);
2674 return iterator; 2675 return iterator;
2675 } 2676 }
2676 2677
2677 } // namespace internal 2678 } // namespace internal
2678 } // namespace v8 2679 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698