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

Unified Diff: src/heap.cc

Issue 240263002: Handlify six more allocators in from the Heap class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index f09922986e92cae9a9eb70b5246ef42b685201d9..2fdac6ab67676f72cf84fd1d24485c9790fea545 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -3543,119 +3543,6 @@ MaybeObject* Heap::AllocateForeign(Address address, PretenureFlag pretenure) {
}
-MaybeObject* Heap::AllocateSharedFunctionInfo(Object* name) {
- SharedFunctionInfo* share;
- MaybeObject* maybe = Allocate(shared_function_info_map(), OLD_POINTER_SPACE);
- if (!maybe->To<SharedFunctionInfo>(&share)) return maybe;
-
- // Set pointer fields.
- share->set_name(name);
- Code* illegal = isolate_->builtins()->builtin(Builtins::kIllegal);
- share->set_code(illegal);
- share->set_optimized_code_map(Smi::FromInt(0));
- share->set_scope_info(ScopeInfo::Empty(isolate_));
- Code* construct_stub =
- isolate_->builtins()->builtin(Builtins::kJSConstructStubGeneric);
- share->set_construct_stub(construct_stub);
- share->set_instance_class_name(Object_string());
- share->set_function_data(undefined_value(), SKIP_WRITE_BARRIER);
- share->set_script(undefined_value(), SKIP_WRITE_BARRIER);
- share->set_debug_info(undefined_value(), SKIP_WRITE_BARRIER);
- share->set_inferred_name(empty_string(), SKIP_WRITE_BARRIER);
- share->set_initial_map(undefined_value(), SKIP_WRITE_BARRIER);
- share->set_ast_node_count(0);
- share->set_counters(0);
-
- // Set integer fields (smi or int, depending on the architecture).
- share->set_length(0);
- share->set_formal_parameter_count(0);
- share->set_expected_nof_properties(0);
- share->set_num_literals(0);
- share->set_start_position_and_type(0);
- share->set_end_position(0);
- share->set_function_token_position(0);
- // All compiler hints default to false or 0.
- share->set_compiler_hints(0);
- share->set_opt_count_and_bailout_reason(0);
-
- return share;
-}
-
-
-MaybeObject* Heap::AllocateJSMessageObject(String* type,
- JSArray* arguments,
- int start_position,
- int end_position,
- Object* script,
- Object* stack_frames) {
- Object* result;
- { MaybeObject* maybe_result = Allocate(message_object_map(), NEW_SPACE);
- if (!maybe_result->ToObject(&result)) return maybe_result;
- }
- JSMessageObject* message = JSMessageObject::cast(result);
- message->set_properties(Heap::empty_fixed_array(), SKIP_WRITE_BARRIER);
- message->initialize_elements();
- message->set_elements(Heap::empty_fixed_array(), SKIP_WRITE_BARRIER);
- message->set_type(type);
- message->set_arguments(arguments);
- message->set_start_position(start_position);
- message->set_end_position(end_position);
- message->set_script(script);
- message->set_stack_frames(stack_frames);
- return result;
-}
-
-
-MaybeObject* Heap::AllocateExternalStringFromAscii(
- const ExternalAsciiString::Resource* resource) {
- size_t length = resource->length();
- if (length > static_cast<size_t>(String::kMaxLength)) {
- return isolate()->ThrowInvalidStringLength();
- }
-
- Map* map = external_ascii_string_map();
- Object* result;
- { MaybeObject* maybe_result = Allocate(map, NEW_SPACE);
- if (!maybe_result->ToObject(&result)) return maybe_result;
- }
-
- ExternalAsciiString* external_string = ExternalAsciiString::cast(result);
- external_string->set_length(static_cast<int>(length));
- external_string->set_hash_field(String::kEmptyHashField);
- external_string->set_resource(resource);
-
- return result;
-}
-
-
-MaybeObject* Heap::AllocateExternalStringFromTwoByte(
- const ExternalTwoByteString::Resource* resource) {
- size_t length = resource->length();
- if (length > static_cast<size_t>(String::kMaxLength)) {
- return isolate()->ThrowInvalidStringLength();
- }
-
- // For small strings we check whether the resource contains only
- // one byte characters. If yes, we use a different string map.
- static const size_t kOneByteCheckLengthLimit = 32;
- bool is_one_byte = length <= kOneByteCheckLengthLimit &&
- String::IsOneByte(resource->data(), static_cast<int>(length));
- Map* map = is_one_byte ?
- external_string_with_one_byte_data_map() : external_string_map();
- Object* result;
- { MaybeObject* maybe_result = Allocate(map, NEW_SPACE);
- if (!maybe_result->ToObject(&result)) return maybe_result;
- }
-
- ExternalTwoByteString* external_string = ExternalTwoByteString::cast(result);
- external_string->set_length(static_cast<int>(length));
- external_string->set_hash_field(String::kEmptyHashField);
- external_string->set_resource(resource);
-
- return result;
-}
-
-
MaybeObject* Heap::LookupSingleCharacterStringFromCode(uint16_t code) {
if (code <= String::kMaxOneByteCharCode) {
Object* value = single_character_string_cache()->get(code);
@@ -4147,52 +4034,6 @@ MaybeObject* Heap::AllocateJSObject(JSFunction* constructor,
}
-MaybeObject* Heap::AllocateJSProxy(Object* handler, Object* prototype) {
- // Allocate map.
- // TODO(rossberg): Once we optimize proxies, think about a scheme to share
- // maps. Will probably depend on the identity of the handler object, too.
- Map* map;
- MaybeObject* maybe_map_obj = AllocateMap(JS_PROXY_TYPE, JSProxy::kSize);
- if (!maybe_map_obj->To<Map>(&map)) return maybe_map_obj;
- map->set_prototype(prototype);
-
- // Allocate the proxy object.
- JSProxy* result;
- MaybeObject* maybe_result = Allocate(map, NEW_SPACE);
- if (!maybe_result->To<JSProxy>(&result)) return maybe_result;
- result->InitializeBody(map->instance_size(), Smi::FromInt(0));
- result->set_handler(handler);
- result->set_hash(undefined_value(), SKIP_WRITE_BARRIER);
- return result;
-}
-
-
-MaybeObject* Heap::AllocateJSFunctionProxy(Object* handler,
- Object* call_trap,
- Object* construct_trap,
- Object* prototype) {
- // Allocate map.
- // TODO(rossberg): Once we optimize proxies, think about a scheme to share
- // maps. Will probably depend on the identity of the handler object, too.
- Map* map;
- MaybeObject* maybe_map_obj =
- AllocateMap(JS_FUNCTION_PROXY_TYPE, JSFunctionProxy::kSize);
- if (!maybe_map_obj->To<Map>(&map)) return maybe_map_obj;
- map->set_prototype(prototype);
-
- // Allocate the proxy object.
- JSFunctionProxy* result;
- MaybeObject* maybe_result = Allocate(map, NEW_SPACE);
- if (!maybe_result->To<JSFunctionProxy>(&result)) return maybe_result;
- result->InitializeBody(map->instance_size(), Smi::FromInt(0));
- result->set_handler(handler);
- result->set_hash(undefined_value(), SKIP_WRITE_BARRIER);
- result->set_call_trap(call_trap);
- result->set_construct_trap(construct_trap);
- return result;
-}
-
-
MaybeObject* Heap::CopyJSObject(JSObject* source, AllocationSite* site) {
// Never used to copy functions. If functions need to be copied we
// have to be careful to clear the literals array.
« no previous file with comments | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698