| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2392 { MaybeObject* maybe_result = Allocate(foreign_map(), space); | 2392 { MaybeObject* maybe_result = Allocate(foreign_map(), space); |
| 2393 if (!maybe_result->ToObject(&result)) return maybe_result; | 2393 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 2394 } | 2394 } |
| 2395 | 2395 |
| 2396 Foreign::cast(result)->set_address(address); | 2396 Foreign::cast(result)->set_address(address); |
| 2397 return result; | 2397 return result; |
| 2398 } | 2398 } |
| 2399 | 2399 |
| 2400 | 2400 |
| 2401 MaybeObject* Heap::AllocateSharedFunctionInfo(Object* name) { | 2401 MaybeObject* Heap::AllocateSharedFunctionInfo(Object* name) { |
| 2402 Object* result; | 2402 SharedFunctionInfo* share; |
| 2403 { MaybeObject* maybe_result = | 2403 MaybeObject* maybe = Allocate(shared_function_info_map(), OLD_POINTER_SPACE); |
| 2404 Allocate(shared_function_info_map(), OLD_POINTER_SPACE); | 2404 if (!maybe->To<SharedFunctionInfo>(&share)) return maybe; |
| 2405 if (!maybe_result->ToObject(&result)) return maybe_result; | |
| 2406 } | |
| 2407 | 2405 |
| 2408 SharedFunctionInfo* share = SharedFunctionInfo::cast(result); | 2406 // Set pointer fields. |
| 2409 share->set_name(name); | 2407 share->set_name(name); |
| 2410 Code* illegal = isolate_->builtins()->builtin(Builtins::kIllegal); | 2408 Code* illegal = isolate_->builtins()->builtin(Builtins::kIllegal); |
| 2411 share->set_code(illegal); | 2409 share->set_code(illegal); |
| 2412 share->set_scope_info(SerializedScopeInfo::Empty()); | 2410 share->set_scope_info(SerializedScopeInfo::Empty()); |
| 2413 Code* construct_stub = isolate_->builtins()->builtin( | 2411 Code* construct_stub = |
| 2414 Builtins::kJSConstructStubGeneric); | 2412 isolate_->builtins()->builtin(Builtins::kJSConstructStubGeneric); |
| 2415 share->set_construct_stub(construct_stub); | 2413 share->set_construct_stub(construct_stub); |
| 2416 share->set_expected_nof_properties(0); | |
| 2417 share->set_length(0); | |
| 2418 share->set_formal_parameter_count(0); | |
| 2419 share->set_instance_class_name(Object_symbol()); | 2414 share->set_instance_class_name(Object_symbol()); |
| 2420 share->set_function_data(undefined_value()); | 2415 share->set_function_data(undefined_value()); |
| 2421 share->set_script(undefined_value()); | 2416 share->set_script(undefined_value()); |
| 2422 share->set_start_position_and_type(0); | |
| 2423 share->set_debug_info(undefined_value()); | 2417 share->set_debug_info(undefined_value()); |
| 2424 share->set_inferred_name(empty_string()); | 2418 share->set_inferred_name(empty_string()); |
| 2425 share->set_compiler_hints(0); | 2419 share->set_initial_map(undefined_value()); |
| 2420 share->set_this_property_assignments(undefined_value()); |
| 2426 share->set_deopt_counter(Smi::FromInt(FLAG_deopt_every_n_times)); | 2421 share->set_deopt_counter(Smi::FromInt(FLAG_deopt_every_n_times)); |
| 2427 share->set_initial_map(undefined_value()); | 2422 |
| 2428 share->set_this_property_assignments_count(0); | 2423 // Set integer fields (smi or int, depending on the architecture). |
| 2429 share->set_this_property_assignments(undefined_value()); | 2424 share->set_length(0); |
| 2430 share->set_opt_count(0); | 2425 share->set_formal_parameter_count(0); |
| 2426 share->set_expected_nof_properties(0); |
| 2431 share->set_num_literals(0); | 2427 share->set_num_literals(0); |
| 2428 share->set_start_position_and_type(0); |
| 2432 share->set_end_position(0); | 2429 share->set_end_position(0); |
| 2433 share->set_function_token_position(0); | 2430 share->set_function_token_position(0); |
| 2434 share->set_native(false); | 2431 // All compiler hints default to false or 0. |
| 2435 return result; | 2432 share->set_compiler_hints(0); |
| 2433 share->set_this_property_assignments_count(0); |
| 2434 share->set_opt_count(0); |
| 2435 |
| 2436 return share; |
| 2436 } | 2437 } |
| 2437 | 2438 |
| 2438 | 2439 |
| 2439 MaybeObject* Heap::AllocateJSMessageObject(String* type, | 2440 MaybeObject* Heap::AllocateJSMessageObject(String* type, |
| 2440 JSArray* arguments, | 2441 JSArray* arguments, |
| 2441 int start_position, | 2442 int start_position, |
| 2442 int end_position, | 2443 int end_position, |
| 2443 Object* script, | 2444 Object* script, |
| 2444 Object* stack_trace, | 2445 Object* stack_trace, |
| 2445 Object* stack_frames) { | 2446 Object* stack_frames) { |
| (...skipping 3606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6052 } | 6053 } |
| 6053 | 6054 |
| 6054 | 6055 |
| 6055 void ExternalStringTable::TearDown() { | 6056 void ExternalStringTable::TearDown() { |
| 6056 new_space_strings_.Free(); | 6057 new_space_strings_.Free(); |
| 6057 old_space_strings_.Free(); | 6058 old_space_strings_.Free(); |
| 6058 } | 6059 } |
| 6059 | 6060 |
| 6060 | 6061 |
| 6061 } } // namespace v8::internal | 6062 } } // namespace v8::internal |
| OLD | NEW |