| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "api.h" | 30 #include "api.h" |
| 31 #include "debug.h" | 31 #include "debug.h" |
| 32 #include "execution.h" | 32 #include "execution.h" |
| 33 #include "factory.h" | 33 #include "factory.h" |
| 34 #include "macro-assembler.h" | 34 #include "macro-assembler.h" |
| 35 #include "objects.h" |
| 35 #include "objects-visiting.h" | 36 #include "objects-visiting.h" |
| 36 | 37 |
| 37 namespace v8 { | 38 namespace v8 { |
| 38 namespace internal { | 39 namespace internal { |
| 39 | 40 |
| 40 | 41 |
| 41 Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) { | 42 Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) { |
| 42 ASSERT(0 <= size); | 43 ASSERT(0 <= size); |
| 43 CALL_HEAP_FUNCTION( | 44 CALL_HEAP_FUNCTION( |
| 44 isolate(), | 45 isolate(), |
| (...skipping 29 matching lines...) Expand all Loading... |
| 74 | 75 |
| 75 | 76 |
| 76 Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors) { | 77 Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors) { |
| 77 ASSERT(0 <= number_of_descriptors); | 78 ASSERT(0 <= number_of_descriptors); |
| 78 CALL_HEAP_FUNCTION(isolate(), | 79 CALL_HEAP_FUNCTION(isolate(), |
| 79 DescriptorArray::Allocate(number_of_descriptors), | 80 DescriptorArray::Allocate(number_of_descriptors), |
| 80 DescriptorArray); | 81 DescriptorArray); |
| 81 } | 82 } |
| 82 | 83 |
| 83 | 84 |
| 85 Handle<DeoptimizationInputData> Factory::NewDeoptimizationInputData( |
| 86 int deopt_entry_count, |
| 87 PretenureFlag pretenure) { |
| 88 ASSERT(deopt_entry_count > 0); |
| 89 CALL_HEAP_FUNCTION(isolate(), |
| 90 DeoptimizationInputData::Allocate(deopt_entry_count, |
| 91 pretenure), |
| 92 DeoptimizationInputData); |
| 93 } |
| 94 |
| 95 |
| 96 Handle<DeoptimizationOutputData> Factory::NewDeoptimizationOutputData( |
| 97 int deopt_entry_count, |
| 98 PretenureFlag pretenure) { |
| 99 ASSERT(deopt_entry_count > 0); |
| 100 CALL_HEAP_FUNCTION(isolate(), |
| 101 DeoptimizationOutputData::Allocate(deopt_entry_count, |
| 102 pretenure), |
| 103 DeoptimizationOutputData); |
| 104 } |
| 105 |
| 106 |
| 84 // Symbols are created in the old generation (data space). | 107 // Symbols are created in the old generation (data space). |
| 85 Handle<String> Factory::LookupSymbol(Vector<const char> string) { | 108 Handle<String> Factory::LookupSymbol(Vector<const char> string) { |
| 86 CALL_HEAP_FUNCTION(isolate(), | 109 CALL_HEAP_FUNCTION(isolate(), |
| 87 isolate()->heap()->LookupSymbol(string), | 110 isolate()->heap()->LookupSymbol(string), |
| 88 String); | 111 String); |
| 89 } | 112 } |
| 90 | 113 |
| 91 | 114 |
| 92 Handle<String> Factory::NewStringFromAscii(Vector<const char> string, | 115 Handle<String> Factory::NewStringFromAscii(Vector<const char> string, |
| 93 PretenureFlag pretenure) { | 116 PretenureFlag pretenure) { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 CALL_HEAP_FUNCTION( | 316 CALL_HEAP_FUNCTION( |
| 294 isolate(), | 317 isolate(), |
| 295 isolate()->heap()->AllocateExternalArray(length, | 318 isolate()->heap()->AllocateExternalArray(length, |
| 296 array_type, | 319 array_type, |
| 297 external_pointer, | 320 external_pointer, |
| 298 pretenure), | 321 pretenure), |
| 299 ExternalArray); | 322 ExternalArray); |
| 300 } | 323 } |
| 301 | 324 |
| 302 | 325 |
| 326 Handle<JSGlobalPropertyCell> Factory::NewJSGlobalPropertyCell( |
| 327 Handle<Object> value) { |
| 328 CALL_HEAP_FUNCTION( |
| 329 isolate(), |
| 330 isolate()->heap()->AllocateJSGlobalPropertyCell(*value), |
| 331 JSGlobalPropertyCell); |
| 332 } |
| 333 |
| 334 |
| 303 Handle<Map> Factory::NewMap(InstanceType type, int instance_size) { | 335 Handle<Map> Factory::NewMap(InstanceType type, int instance_size) { |
| 304 CALL_HEAP_FUNCTION( | 336 CALL_HEAP_FUNCTION( |
| 305 isolate(), | 337 isolate(), |
| 306 isolate()->heap()->AllocateMap(type, instance_size), | 338 isolate()->heap()->AllocateMap(type, instance_size), |
| 307 Map); | 339 Map); |
| 308 } | 340 } |
| 309 | 341 |
| 310 | 342 |
| 311 Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) { | 343 Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) { |
| 312 CALL_HEAP_FUNCTION( | 344 CALL_HEAP_FUNCTION( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 int number_of_literals = function_info->num_literals(); | 422 int number_of_literals = function_info->num_literals(); |
| 391 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); | 423 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); |
| 392 if (number_of_literals > 0) { | 424 if (number_of_literals > 0) { |
| 393 // Store the object, regexp and array functions in the literals | 425 // Store the object, regexp and array functions in the literals |
| 394 // array prefix. These functions will be used when creating | 426 // array prefix. These functions will be used when creating |
| 395 // object, regexp and array literals in this function. | 427 // object, regexp and array literals in this function. |
| 396 literals->set(JSFunction::kLiteralGlobalContextIndex, | 428 literals->set(JSFunction::kLiteralGlobalContextIndex, |
| 397 context->global_context()); | 429 context->global_context()); |
| 398 } | 430 } |
| 399 result->set_literals(*literals); | 431 result->set_literals(*literals); |
| 432 result->set_next_function_link(isolate()->heap()->undefined_value()); |
| 433 |
| 434 if (V8::UseCrankshaft() && |
| 435 FLAG_always_opt && |
| 436 result->is_compiled() && |
| 437 !function_info->is_toplevel() && |
| 438 function_info->allows_lazy_compilation()) { |
| 439 result->MarkForLazyRecompilation(); |
| 440 } |
| 400 return result; | 441 return result; |
| 401 } | 442 } |
| 402 | 443 |
| 403 | 444 |
| 404 Handle<Object> Factory::NewNumber(double value, | 445 Handle<Object> Factory::NewNumber(double value, |
| 405 PretenureFlag pretenure) { | 446 PretenureFlag pretenure) { |
| 406 CALL_HEAP_FUNCTION( | 447 CALL_HEAP_FUNCTION( |
| 407 isolate(), | 448 isolate(), |
| 408 isolate()->heap()->NumberFromDouble(value, pretenure), Object); | 449 isolate()->heap()->NumberFromDouble(value, pretenure), Object); |
| 409 } | 450 } |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 Execution::ConfigureInstance(instance, | 1145 Execution::ConfigureInstance(instance, |
| 1105 instance_template, | 1146 instance_template, |
| 1106 pending_exception); | 1147 pending_exception); |
| 1107 } else { | 1148 } else { |
| 1108 *pending_exception = false; | 1149 *pending_exception = false; |
| 1109 } | 1150 } |
| 1110 } | 1151 } |
| 1111 | 1152 |
| 1112 | 1153 |
| 1113 } } // namespace v8::internal | 1154 } } // namespace v8::internal |
| OLD | NEW |