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

Side by Side Diff: src/factory.cc

Issue 247263003: Hide heap methods where possible. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/factory.h ('k') | src/heap.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 "factory.h" 5 #include "factory.h"
6 6
7 #include "conversions.h" 7 #include "conversions.h"
8 #include "isolate-inl.h" 8 #include "isolate-inl.h"
9 #include "macro-assembler.h" 9 #include "macro-assembler.h"
10 10
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 624
625 Handle<Symbol> Factory::NewSymbol() { 625 Handle<Symbol> Factory::NewSymbol() {
626 CALL_HEAP_FUNCTION( 626 CALL_HEAP_FUNCTION(
627 isolate(), 627 isolate(),
628 isolate()->heap()->AllocateSymbol(), 628 isolate()->heap()->AllocateSymbol(),
629 Symbol); 629 Symbol);
630 } 630 }
631 631
632 632
633 Handle<Symbol> Factory::NewPrivateSymbol() { 633 Handle<Symbol> Factory::NewPrivateSymbol() {
634 CALL_HEAP_FUNCTION( 634 Handle<Symbol> symbol = NewSymbol();
635 isolate(), 635 symbol->set_is_private(true);
636 isolate()->heap()->AllocatePrivateSymbol(), 636 return symbol;
637 Symbol);
638 } 637 }
639 638
640 639
641 Handle<Context> Factory::NewNativeContext() { 640 Handle<Context> Factory::NewNativeContext() {
642 Handle<FixedArray> array = NewFixedArray(Context::NATIVE_CONTEXT_SLOTS); 641 Handle<FixedArray> array = NewFixedArray(Context::NATIVE_CONTEXT_SLOTS);
643 array->set_map_no_write_barrier(*native_context_map()); 642 array->set_map_no_write_barrier(*native_context_map());
644 Handle<Context> context = Handle<Context>::cast(array); 643 Handle<Context> context = Handle<Context>::cast(array);
645 context->set_js_array_maps(*undefined_value()); 644 context->set_js_array_maps(*undefined_value());
646 ASSERT(context->IsNativeContext()); 645 ASSERT(context->IsNativeContext());
647 return context; 646 return context;
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 1325
1327 1326
1328 Handle<JSObject> Factory::NewExternal(void* value) { 1327 Handle<JSObject> Factory::NewExternal(void* value) {
1329 Handle<Foreign> foreign = NewForeign(static_cast<Address>(value)); 1328 Handle<Foreign> foreign = NewForeign(static_cast<Address>(value));
1330 Handle<JSObject> external = NewJSObjectFromMap(external_map()); 1329 Handle<JSObject> external = NewJSObjectFromMap(external_map());
1331 external->SetInternalField(0, *foreign); 1330 external->SetInternalField(0, *foreign);
1332 return external; 1331 return external;
1333 } 1332 }
1334 1333
1335 1334
1336 Handle<Code> NewCodeHelper(Isolate* isolate, int object_size, bool immovable) { 1335 Handle<Code> Factory::NewCodeRaw(int object_size, bool immovable) {
1337 CALL_HEAP_FUNCTION(isolate, 1336 CALL_HEAP_FUNCTION(isolate(),
1338 isolate->heap()->AllocateCode(object_size, immovable), 1337 isolate()->heap()->AllocateCode(object_size, immovable),
1339 Code); 1338 Code);
1340 } 1339 }
1341 1340
1342 1341
1343 Handle<Code> Factory::NewCode(const CodeDesc& desc, 1342 Handle<Code> Factory::NewCode(const CodeDesc& desc,
1344 Code::Flags flags, 1343 Code::Flags flags,
1345 Handle<Object> self_ref, 1344 Handle<Object> self_ref,
1346 bool immovable, 1345 bool immovable,
1347 bool crankshafted, 1346 bool crankshafted,
1348 int prologue_offset) { 1347 int prologue_offset) {
1349 Handle<ByteArray> reloc_info = NewByteArray(desc.reloc_size, TENURED); 1348 Handle<ByteArray> reloc_info = NewByteArray(desc.reloc_size, TENURED);
1350 Handle<ConstantPoolArray> constant_pool = 1349 Handle<ConstantPoolArray> constant_pool =
1351 desc.origin->NewConstantPool(isolate()); 1350 desc.origin->NewConstantPool(isolate());
1352 1351
1353 // Compute size. 1352 // Compute size.
1354 int body_size = RoundUp(desc.instr_size, kObjectAlignment); 1353 int body_size = RoundUp(desc.instr_size, kObjectAlignment);
1355 int obj_size = Code::SizeFor(body_size); 1354 int obj_size = Code::SizeFor(body_size);
1356 1355
1357 Handle<Code> code = NewCodeHelper(isolate(), obj_size, immovable); 1356 Handle<Code> code = NewCodeRaw(obj_size, immovable);
1358 ASSERT(!isolate()->code_range()->exists() || 1357 ASSERT(!isolate()->code_range()->exists() ||
1359 isolate()->code_range()->contains(code->address())); 1358 isolate()->code_range()->contains(code->address()));
1360 1359
1361 // The code object has not been fully initialized yet. We rely on the 1360 // The code object has not been fully initialized yet. We rely on the
1362 // fact that no allocation will happen from this point on. 1361 // fact that no allocation will happen from this point on.
1363 DisallowHeapAllocation no_gc; 1362 DisallowHeapAllocation no_gc;
1364 code->set_gc_metadata(Smi::FromInt(0)); 1363 code->set_gc_metadata(Smi::FromInt(0));
1365 code->set_ic_age(isolate()->heap()->global_ic_age()); 1364 code->set_ic_age(isolate()->heap()->global_ic_age());
1366 code->set_instruction_size(desc.instr_size); 1365 code->set_instruction_size(desc.instr_size);
1367 code->set_relocation_info(*reloc_info); 1366 code->set_relocation_info(*reloc_info);
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
2303 return Handle<Object>::null(); 2302 return Handle<Object>::null();
2304 } 2303 }
2305 2304
2306 2305
2307 Handle<Object> Factory::ToBoolean(bool value) { 2306 Handle<Object> Factory::ToBoolean(bool value) {
2308 return value ? true_value() : false_value(); 2307 return value ? true_value() : false_value();
2309 } 2308 }
2310 2309
2311 2310
2312 } } // namespace v8::internal 2311 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698