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

Side by Side Diff: src/factory.cc

Issue 2655853010: [TypeFeedbackVector] Combine the literals array and the feedback vector. (Closed)
Patch Set: more comments. Created 3 years, 10 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/full-codegen/arm/full-codegen-arm.cc » ('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 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 Handle<JSFunction> function = New<JSFunction>(map, space); 1410 Handle<JSFunction> function = New<JSFunction>(map, space);
1411 DCHECK(context_or_undefined->IsContext() || 1411 DCHECK(context_or_undefined->IsContext() ||
1412 context_or_undefined->IsUndefined(isolate())); 1412 context_or_undefined->IsUndefined(isolate()));
1413 1413
1414 function->initialize_properties(); 1414 function->initialize_properties();
1415 function->initialize_elements(); 1415 function->initialize_elements();
1416 function->set_shared(*info); 1416 function->set_shared(*info);
1417 function->set_code(info->code()); 1417 function->set_code(info->code());
1418 function->set_context(*context_or_undefined); 1418 function->set_context(*context_or_undefined);
1419 function->set_prototype_or_initial_map(*the_hole_value()); 1419 function->set_prototype_or_initial_map(*the_hole_value());
1420 function->set_literals(LiteralsArray::cast(*empty_literals_array())); 1420 function->set_feedback_vector(
1421 TypeFeedbackVector::cast(*empty_type_feedback_vector()));
1421 function->set_next_function_link(*undefined_value(), SKIP_WRITE_BARRIER); 1422 function->set_next_function_link(*undefined_value(), SKIP_WRITE_BARRIER);
1422 isolate()->heap()->InitializeJSObjectBody(*function, *map, JSFunction::kSize); 1423 isolate()->heap()->InitializeJSObjectBody(*function, *map, JSFunction::kSize);
1423 return function; 1424 return function;
1424 } 1425 }
1425 1426
1426 1427
1427 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, 1428 Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
1428 Handle<String> name, 1429 Handle<String> name,
1429 MaybeHandle<Code> code) { 1430 MaybeHandle<Code> code) {
1430 Handle<Context> context(isolate()->native_context()); 1431 Handle<Context> context(isolate()->native_context());
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 int map_index = 1544 int map_index =
1544 Context::FunctionMapIndex(info->language_mode(), info->kind()); 1545 Context::FunctionMapIndex(info->language_mode(), info->kind());
1545 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index))); 1546 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index)));
1546 1547
1547 return NewFunctionFromSharedFunctionInfo(initial_map, info, context, 1548 return NewFunctionFromSharedFunctionInfo(initial_map, info, context,
1548 pretenure); 1549 pretenure);
1549 } 1550 }
1550 1551
1551 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 1552 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1552 Handle<SharedFunctionInfo> info, Handle<Context> context, 1553 Handle<SharedFunctionInfo> info, Handle<Context> context,
1553 Handle<LiteralsArray> literals, PretenureFlag pretenure) { 1554 Handle<TypeFeedbackVector> vector, PretenureFlag pretenure) {
1554 int map_index = 1555 int map_index =
1555 Context::FunctionMapIndex(info->language_mode(), info->kind()); 1556 Context::FunctionMapIndex(info->language_mode(), info->kind());
1556 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index))); 1557 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index)));
1557 1558
1558 return NewFunctionFromSharedFunctionInfo(initial_map, info, context, literals, 1559 return NewFunctionFromSharedFunctionInfo(initial_map, info, context, vector,
1559 pretenure); 1560 pretenure);
1560 } 1561 }
1561 1562
1562 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 1563 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1563 Handle<Map> initial_map, Handle<SharedFunctionInfo> info, 1564 Handle<Map> initial_map, Handle<SharedFunctionInfo> info,
1564 Handle<Object> context_or_undefined, PretenureFlag pretenure) { 1565 Handle<Object> context_or_undefined, PretenureFlag pretenure) {
1565 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type()); 1566 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type());
1566 Handle<JSFunction> result = 1567 Handle<JSFunction> result =
1567 NewFunction(initial_map, info, context_or_undefined, pretenure); 1568 NewFunction(initial_map, info, context_or_undefined, pretenure);
1568 1569
1569 if (info->ic_age() != isolate()->heap()->global_ic_age()) { 1570 if (info->ic_age() != isolate()->heap()->global_ic_age()) {
1570 info->ResetForNewContext(isolate()->heap()->global_ic_age()); 1571 info->ResetForNewContext(isolate()->heap()->global_ic_age());
1571 } 1572 }
1572 1573
1573 if (context_or_undefined->IsContext()) { 1574 if (context_or_undefined->IsContext()) {
1574 // Give compiler a chance to pre-initialize. 1575 // Give compiler a chance to pre-initialize.
1575 Compiler::PostInstantiation(result, pretenure); 1576 Compiler::PostInstantiation(result, pretenure);
1576 } 1577 }
1577 1578
1578 return result; 1579 return result;
1579 } 1580 }
1580 1581
1581 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 1582 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1582 Handle<Map> initial_map, Handle<SharedFunctionInfo> info, 1583 Handle<Map> initial_map, Handle<SharedFunctionInfo> info,
1583 Handle<Object> context_or_undefined, Handle<LiteralsArray> literals, 1584 Handle<Object> context_or_undefined, Handle<TypeFeedbackVector> vector,
1584 PretenureFlag pretenure) { 1585 PretenureFlag pretenure) {
1585 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type()); 1586 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type());
1586 Handle<JSFunction> result = 1587 Handle<JSFunction> result =
1587 NewFunction(initial_map, info, context_or_undefined, pretenure); 1588 NewFunction(initial_map, info, context_or_undefined, pretenure);
1588 1589
1589 result->set_literals(*literals); 1590 result->set_feedback_vector(*vector);
1590 if (info->ic_age() != isolate()->heap()->global_ic_age()) { 1591 if (info->ic_age() != isolate()->heap()->global_ic_age()) {
1591 info->ResetForNewContext(isolate()->heap()->global_ic_age()); 1592 info->ResetForNewContext(isolate()->heap()->global_ic_age());
1592 } 1593 }
1593 1594
1594 if (context_or_undefined->IsContext()) { 1595 if (context_or_undefined->IsContext()) {
1595 // Give compiler a chance to pre-initialize. 1596 // Give compiler a chance to pre-initialize.
1596 Compiler::PostInstantiation(result, pretenure); 1597 Compiler::PostInstantiation(result, pretenure);
1597 } 1598 }
1598 1599
1599 return result; 1600 return result;
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2845 Handle<AccessorInfo> prototype = 2846 Handle<AccessorInfo> prototype =
2846 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); 2847 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs);
2847 Descriptor d = Descriptor::AccessorConstant( 2848 Descriptor d = Descriptor::AccessorConstant(
2848 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); 2849 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs);
2849 map->AppendDescriptor(&d); 2850 map->AppendDescriptor(&d);
2850 } 2851 }
2851 } 2852 }
2852 2853
2853 } // namespace internal 2854 } // namespace internal
2854 } // namespace v8 2855 } // namespace v8
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698