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

Side by Side Diff: src/factory.cc

Issue 2614373002: [FeedbackVector] Infrastructure for literal arrays in the vector. (Closed)
Patch Set: Release compile fix. Created 3 years, 11 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/factory.h ('k') | src/flag-definitions.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/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 PretenureFlag pretenure) { 1508 PretenureFlag pretenure) {
1509 int map_index = 1509 int map_index =
1510 Context::FunctionMapIndex(info->language_mode(), info->kind()); 1510 Context::FunctionMapIndex(info->language_mode(), info->kind());
1511 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index))); 1511 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index)));
1512 1512
1513 return NewFunctionFromSharedFunctionInfo(initial_map, info, context, 1513 return NewFunctionFromSharedFunctionInfo(initial_map, info, context,
1514 pretenure); 1514 pretenure);
1515 } 1515 }
1516 1516
1517 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 1517 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1518 Handle<SharedFunctionInfo> info, Handle<Context> context,
1519 Handle<LiteralsArray> literals, PretenureFlag pretenure) {
1520 int map_index =
1521 Context::FunctionMapIndex(info->language_mode(), info->kind());
1522 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index)));
1523
1524 return NewFunctionFromSharedFunctionInfo(initial_map, info, context, literals,
1525 pretenure);
1526 }
1527
1528 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1518 Handle<Map> initial_map, Handle<SharedFunctionInfo> info, 1529 Handle<Map> initial_map, Handle<SharedFunctionInfo> info,
1519 Handle<Object> context_or_undefined, PretenureFlag pretenure) { 1530 Handle<Object> context_or_undefined, PretenureFlag pretenure) {
1520 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type()); 1531 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type());
1521 Handle<JSFunction> result = 1532 Handle<JSFunction> result =
1522 NewFunction(initial_map, info, context_or_undefined, pretenure); 1533 NewFunction(initial_map, info, context_or_undefined, pretenure);
1523 1534
1524 if (info->ic_age() != isolate()->heap()->global_ic_age()) { 1535 if (info->ic_age() != isolate()->heap()->global_ic_age()) {
1525 info->ResetForNewContext(isolate()->heap()->global_ic_age()); 1536 info->ResetForNewContext(isolate()->heap()->global_ic_age());
1526 } 1537 }
1527 1538
1528 if (context_or_undefined->IsContext()) { 1539 if (context_or_undefined->IsContext()) {
1529 // Give compiler a chance to pre-initialize. 1540 // Give compiler a chance to pre-initialize.
1530 Compiler::PostInstantiation(result, pretenure); 1541 Compiler::PostInstantiation(result, pretenure);
1531 } 1542 }
1532 1543
1533 return result; 1544 return result;
1534 } 1545 }
1535 1546
1547 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1548 Handle<Map> initial_map, Handle<SharedFunctionInfo> info,
1549 Handle<Object> context_or_undefined, Handle<LiteralsArray> literals,
1550 PretenureFlag pretenure) {
1551 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type());
1552 Handle<JSFunction> result =
1553 NewFunction(initial_map, info, context_or_undefined, pretenure);
1554
1555 result->set_literals(*literals);
1556 if (info->ic_age() != isolate()->heap()->global_ic_age()) {
1557 info->ResetForNewContext(isolate()->heap()->global_ic_age());
1558 }
1559
1560 if (context_or_undefined->IsContext()) {
1561 // Give compiler a chance to pre-initialize.
1562 Compiler::PostInstantiation(result, pretenure);
1563 }
1564
1565 return result;
1566 }
1536 1567
1537 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { 1568 Handle<ScopeInfo> Factory::NewScopeInfo(int length) {
1538 Handle<FixedArray> array = NewFixedArray(length, TENURED); 1569 Handle<FixedArray> array = NewFixedArray(length, TENURED);
1539 array->set_map_no_write_barrier(*scope_info_map()); 1570 array->set_map_no_write_barrier(*scope_info_map());
1540 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); 1571 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array);
1541 return scope_info; 1572 return scope_info;
1542 } 1573 }
1543 1574
1544 Handle<ModuleInfo> Factory::NewModuleInfo() { 1575 Handle<ModuleInfo> Factory::NewModuleInfo() {
1545 Handle<FixedArray> array = NewFixedArray(ModuleInfo::kLength, TENURED); 1576 Handle<FixedArray> array = NewFixedArray(ModuleInfo::kLength, TENURED);
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2765 Handle<AccessorInfo> prototype = 2796 Handle<AccessorInfo> prototype =
2766 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); 2797 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs);
2767 Descriptor d = Descriptor::AccessorConstant( 2798 Descriptor d = Descriptor::AccessorConstant(
2768 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); 2799 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs);
2769 map->AppendDescriptor(&d); 2800 map->AppendDescriptor(&d);
2770 } 2801 }
2771 } 2802 }
2772 2803
2773 } // namespace internal 2804 } // namespace internal
2774 } // namespace v8 2805 } // namespace v8
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698