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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 int num_enum = object->NumberOfEnumProperties(); | 415 int num_enum = object->NumberOfEnumProperties(); |
416 Handle<FixedArray> storage = Factory::NewFixedArray(num_enum); | 416 Handle<FixedArray> storage = Factory::NewFixedArray(num_enum); |
417 Handle<FixedArray> sort_array = Factory::NewFixedArray(num_enum); | 417 Handle<FixedArray> sort_array = Factory::NewFixedArray(num_enum); |
418 object->property_dictionary()->CopyEnumKeysTo(*storage, *sort_array); | 418 object->property_dictionary()->CopyEnumKeysTo(*storage, *sort_array); |
419 return storage; | 419 return storage; |
420 } | 420 } |
421 } | 421 } |
422 | 422 |
423 | 423 |
424 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, | 424 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, |
425 ClearExceptionFlag flag) { | 425 ClearExceptionFlag flag, |
| 426 int loop_nesting) { |
426 // Compile the source information to a code object. | 427 // Compile the source information to a code object. |
427 ASSERT(!shared->is_compiled()); | 428 ASSERT(!shared->is_compiled()); |
428 bool result = Compiler::CompileLazy(shared); | 429 bool result = Compiler::CompileLazy(shared, loop_nesting); |
429 ASSERT(result != Top::has_pending_exception()); | 430 ASSERT(result != Top::has_pending_exception()); |
430 if (!result && flag == CLEAR_EXCEPTION) Top::clear_pending_exception(); | 431 if (!result && flag == CLEAR_EXCEPTION) Top::clear_pending_exception(); |
431 return result; | 432 return result; |
432 } | 433 } |
433 | 434 |
434 | 435 |
435 bool CompileLazy(Handle<JSFunction> function, ClearExceptionFlag flag) { | 436 bool CompileLazy(Handle<JSFunction> function, ClearExceptionFlag flag) { |
436 // Compile the source information to a code object. | 437 // Compile the source information to a code object. |
437 Handle<SharedFunctionInfo> shared(function->shared()); | 438 Handle<SharedFunctionInfo> shared(function->shared()); |
438 return CompileLazyShared(shared, flag); | 439 return CompileLazyShared(shared, flag, 0); |
439 } | 440 } |
440 | 441 |
441 | 442 |
| 443 bool CompileLazyInLoop(Handle<JSFunction> function, ClearExceptionFlag flag) { |
| 444 // Compile the source information to a code object. |
| 445 Handle<SharedFunctionInfo> shared(function->shared()); |
| 446 return CompileLazyShared(shared, flag, 1); |
| 447 } |
| 448 |
442 OptimizedObjectForAddingMultipleProperties:: | 449 OptimizedObjectForAddingMultipleProperties:: |
443 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, | 450 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, |
444 bool condition) { | 451 bool condition) { |
445 object_ = object; | 452 object_ = object; |
446 if (condition && object_->HasFastProperties()) { | 453 if (condition && object_->HasFastProperties()) { |
447 // Normalize the properties of object to avoid n^2 behavior | 454 // Normalize the properties of object to avoid n^2 behavior |
448 // when extending the object multiple properties. | 455 // when extending the object multiple properties. |
449 unused_property_fields_ = object->map()->unused_property_fields(); | 456 unused_property_fields_ = object->map()->unused_property_fields(); |
450 NormalizeProperties(object_); | 457 NormalizeProperties(object_); |
451 has_been_transformed_ = true; | 458 has_been_transformed_ = true; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 Handle<Context> compile_context, | 534 Handle<Context> compile_context, |
528 Handle<Context> function_context) { | 535 Handle<Context> function_context) { |
529 Handle<FixedArray> arr = Factory::NewFixedArray(3); | 536 Handle<FixedArray> arr = Factory::NewFixedArray(3); |
530 arr->set(0, Smi::FromInt(index)); | 537 arr->set(0, Smi::FromInt(index)); |
531 arr->set(1, *compile_context); // Compile in this context | 538 arr->set(1, *compile_context); // Compile in this context |
532 arr->set(2, *function_context); // Set function context to this | 539 arr->set(2, *function_context); // Set function context to this |
533 fun->shared()->set_lazy_load_data(*arr); | 540 fun->shared()->set_lazy_load_data(*arr); |
534 } | 541 } |
535 | 542 |
536 } } // namespace v8::internal | 543 } } // namespace v8::internal |
OLD | NEW |