OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 ASSERT(!function->has_initial_map()); | 470 ASSERT(!function->has_initial_map()); |
471 ASSERT(!function->has_prototype()); | 471 ASSERT(!function->has_prototype()); |
472 } | 472 } |
473 | 473 |
474 return function; | 474 return function; |
475 } | 475 } |
476 | 476 |
477 | 477 |
478 Handle<JSFunction> Factory::NewFunctionBoilerplate(Handle<String> name, | 478 Handle<JSFunction> Factory::NewFunctionBoilerplate(Handle<String> name, |
479 int number_of_literals, | 479 int number_of_literals, |
480 bool contains_array_literal, | |
481 Handle<Code> code) { | 480 Handle<Code> code) { |
482 Handle<JSFunction> function = NewFunctionBoilerplate(name); | 481 Handle<JSFunction> function = NewFunctionBoilerplate(name); |
483 function->set_code(*code); | 482 function->set_code(*code); |
484 int literals_array_size = number_of_literals; | 483 int literals_array_size = number_of_literals; |
485 // If the function contains object, regexp or array literals, | 484 // If the function contains object, regexp or array literals, |
486 // allocate extra space for a literals array prefix containing the | 485 // allocate extra space for a literals array prefix containing the |
487 // object, regexp and array constructor functions. | 486 // object, regexp and array constructor functions. |
488 if (number_of_literals > 0 || contains_array_literal) { | 487 if (number_of_literals > 0) { |
489 literals_array_size += JSFunction::kLiteralsPrefixSize; | 488 literals_array_size += JSFunction::kLiteralsPrefixSize; |
490 } | 489 } |
491 Handle<FixedArray> literals = | 490 Handle<FixedArray> literals = |
492 Factory::NewFixedArray(literals_array_size, TENURED); | 491 Factory::NewFixedArray(literals_array_size, TENURED); |
493 function->set_literals(*literals); | 492 function->set_literals(*literals); |
494 ASSERT(!function->has_initial_map()); | 493 ASSERT(!function->has_initial_map()); |
495 ASSERT(!function->has_prototype()); | 494 ASSERT(!function->has_prototype()); |
496 return function; | 495 return function; |
497 } | 496 } |
498 | 497 |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 Execution::ConfigureInstance(instance, | 933 Execution::ConfigureInstance(instance, |
935 instance_template, | 934 instance_template, |
936 pending_exception); | 935 pending_exception); |
937 } else { | 936 } else { |
938 *pending_exception = false; | 937 *pending_exception = false; |
939 } | 938 } |
940 } | 939 } |
941 | 940 |
942 | 941 |
943 } } // namespace v8::internal | 942 } } // namespace v8::internal |
OLD | NEW |