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

Side by Side Diff: src/factory.cc

Issue 2811183005: Do not use new struct type where unnecessary. (Closed)
Patch Set: rebase Created 3 years, 8 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/deoptimizer.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/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 Handle<ScopeInfo> scope_info, Handle<Object> extension) { 121 Handle<ScopeInfo> scope_info, Handle<Object> extension) {
122 Handle<ContextExtension> result = 122 Handle<ContextExtension> result =
123 Handle<ContextExtension>::cast(NewStruct(CONTEXT_EXTENSION_TYPE)); 123 Handle<ContextExtension>::cast(NewStruct(CONTEXT_EXTENSION_TYPE));
124 result->set_scope_info(*scope_info); 124 result->set_scope_info(*scope_info);
125 result->set_extension(*extension); 125 result->set_extension(*extension);
126 return result; 126 return result;
127 } 127 }
128 128
129 Handle<ConstantElementsPair> Factory::NewConstantElementsPair( 129 Handle<ConstantElementsPair> Factory::NewConstantElementsPair(
130 ElementsKind elements_kind, Handle<FixedArrayBase> constant_values) { 130 ElementsKind elements_kind, Handle<FixedArrayBase> constant_values) {
131 Handle<ConstantElementsPair> result = Handle<ConstantElementsPair>::cast( 131 Handle<ConstantElementsPair> result =
132 NewStruct(CONSTANT_ELEMENTS_PAIR_TYPE)); 132 Handle<ConstantElementsPair>::cast(NewStruct(TUPLE2_TYPE));
133 result->set_elements_kind(elements_kind); 133 result->set_elements_kind(elements_kind);
134 result->set_constant_values(*constant_values); 134 result->set_constant_values(*constant_values);
135 return result; 135 return result;
136 } 136 }
137 137
138 Handle<Oddball> Factory::NewOddball(Handle<Map> map, const char* to_string, 138 Handle<Oddball> Factory::NewOddball(Handle<Map> map, const char* to_string,
139 Handle<Object> to_number, 139 Handle<Object> to_number,
140 const char* type_of, byte kind) { 140 const char* type_of, byte kind) {
141 Handle<Oddball> oddball = New<Oddball>(map, OLD_SPACE); 141 Handle<Oddball> oddball = New<Oddball>(map, OLD_SPACE);
142 Oddball::Initialize(isolate(), oddball, to_string, to_number, type_of, kind); 142 Oddball::Initialize(isolate(), oddball, to_string, to_number, type_of, kind);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 Handle<AccessorPair> accessors = 253 Handle<AccessorPair> accessors =
254 Handle<AccessorPair>::cast(NewStruct(ACCESSOR_PAIR_TYPE)); 254 Handle<AccessorPair>::cast(NewStruct(ACCESSOR_PAIR_TYPE));
255 accessors->set_getter(*null_value(), SKIP_WRITE_BARRIER); 255 accessors->set_getter(*null_value(), SKIP_WRITE_BARRIER);
256 accessors->set_setter(*null_value(), SKIP_WRITE_BARRIER); 256 accessors->set_setter(*null_value(), SKIP_WRITE_BARRIER);
257 return accessors; 257 return accessors;
258 } 258 }
259 259
260 260
261 Handle<TypeFeedbackInfo> Factory::NewTypeFeedbackInfo() { 261 Handle<TypeFeedbackInfo> Factory::NewTypeFeedbackInfo() {
262 Handle<TypeFeedbackInfo> info = 262 Handle<TypeFeedbackInfo> info =
263 Handle<TypeFeedbackInfo>::cast(NewStruct(TYPE_FEEDBACK_INFO_TYPE)); 263 Handle<TypeFeedbackInfo>::cast(NewStruct(TUPLE3_TYPE));
264 info->initialize_storage(); 264 info->initialize_storage();
265 return info; 265 return info;
266 } 266 }
267 267
268 268
269 // Internalized strings are created in the old generation (data space). 269 // Internalized strings are created in the old generation (data space).
270 Handle<String> Factory::InternalizeUtf8String(Vector<const char> string) { 270 Handle<String> Factory::InternalizeUtf8String(Vector<const char> string) {
271 Utf8StringKey key(string, isolate()->heap()->HashSeed()); 271 Utf8StringKey key(string, isolate()->heap()->HashSeed());
272 return InternalizeStringWithKey(&key); 272 return InternalizeStringWithKey(&key);
273 } 273 }
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2594 debug_info->set_break_points(*break_points); 2594 debug_info->set_break_points(*break_points);
2595 2595
2596 // Link debug info to function. 2596 // Link debug info to function.
2597 shared->set_debug_info(*debug_info); 2597 shared->set_debug_info(*debug_info);
2598 2598
2599 return debug_info; 2599 return debug_info;
2600 } 2600 }
2601 2601
2602 Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) { 2602 Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) {
2603 Handle<BreakPointInfo> new_break_point_info = 2603 Handle<BreakPointInfo> new_break_point_info =
2604 Handle<BreakPointInfo>::cast(NewStruct(BREAK_POINT_INFO_TYPE)); 2604 Handle<BreakPointInfo>::cast(NewStruct(TUPLE2_TYPE));
2605 new_break_point_info->set_source_position(source_position); 2605 new_break_point_info->set_source_position(source_position);
2606 new_break_point_info->set_break_point_objects(*undefined_value()); 2606 new_break_point_info->set_break_point_objects(*undefined_value());
2607 return new_break_point_info; 2607 return new_break_point_info;
2608 } 2608 }
2609 2609
2610 Handle<StackFrameInfo> Factory::NewStackFrameInfo() { 2610 Handle<StackFrameInfo> Factory::NewStackFrameInfo() {
2611 Handle<StackFrameInfo> stack_frame_info = 2611 Handle<StackFrameInfo> stack_frame_info =
2612 Handle<StackFrameInfo>::cast(NewStruct(STACK_FRAME_INFO_TYPE)); 2612 Handle<StackFrameInfo>::cast(NewStruct(STACK_FRAME_INFO_TYPE));
2613 stack_frame_info->set_line_number(0); 2613 stack_frame_info->set_line_number(0);
2614 stack_frame_info->set_column_number(0); 2614 stack_frame_info->set_column_number(0);
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 Handle<AccessorInfo> prototype = 2934 Handle<AccessorInfo> prototype =
2935 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); 2935 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs);
2936 Descriptor d = Descriptor::AccessorConstant( 2936 Descriptor d = Descriptor::AccessorConstant(
2937 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); 2937 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs);
2938 map->AppendDescriptor(&d); 2938 map->AppendDescriptor(&d);
2939 } 2939 }
2940 } 2940 }
2941 2941
2942 } // namespace internal 2942 } // namespace internal
2943 } // namespace v8 2943 } // namespace v8
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698