Chromium Code Reviews| 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 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 985 elms->set(VALUE_INDEX, *substr); | 985 elms->set(VALUE_INDEX, *substr); |
| 986 elms->set(WRITABLE_INDEX, heap->false_value()); | 986 elms->set(WRITABLE_INDEX, heap->false_value()); |
| 987 elms->set(ENUMERABLE_INDEX, heap->false_value()); | 987 elms->set(ENUMERABLE_INDEX, heap->false_value()); |
| 988 elms->set(CONFIGURABLE_INDEX, heap->false_value()); | 988 elms->set(CONFIGURABLE_INDEX, heap->false_value()); |
| 989 return *desc; | 989 return *desc; |
| 990 } | 990 } |
| 991 | 991 |
| 992 case JSObject::INTERCEPTED_ELEMENT: | 992 case JSObject::INTERCEPTED_ELEMENT: |
| 993 case JSObject::FAST_ELEMENT: { | 993 case JSObject::FAST_ELEMENT: { |
| 994 elms->set(IS_ACCESSOR_INDEX, heap->false_value()); | 994 elms->set(IS_ACCESSOR_INDEX, heap->false_value()); |
| 995 Handle<Object> value = GetElement(obj, index); | 995 Handle<Object> value = Object::GetElement(obj, index); |
| 996 RETURN_IF_EMPTY_HANDLE(isolate, value); | 996 RETURN_IF_EMPTY_HANDLE(isolate, value); |
| 997 elms->set(VALUE_INDEX, *value); | 997 elms->set(VALUE_INDEX, *value); |
| 998 elms->set(WRITABLE_INDEX, heap->true_value()); | 998 elms->set(WRITABLE_INDEX, heap->true_value()); |
| 999 elms->set(ENUMERABLE_INDEX, heap->true_value()); | 999 elms->set(ENUMERABLE_INDEX, heap->true_value()); |
| 1000 elms->set(CONFIGURABLE_INDEX, heap->true_value()); | 1000 elms->set(CONFIGURABLE_INDEX, heap->true_value()); |
| 1001 return *desc; | 1001 return *desc; |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 case JSObject::DICTIONARY_ELEMENT: { | 1004 case JSObject::DICTIONARY_ELEMENT: { |
| 1005 Handle<JSObject> holder = obj; | 1005 Handle<JSObject> holder = obj; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1029 elms->set(GETTER_INDEX, callbacks->get(0)); | 1029 elms->set(GETTER_INDEX, callbacks->get(0)); |
| 1030 } | 1030 } |
| 1031 if (CheckElementAccess(*obj, index, v8::ACCESS_SET)) { | 1031 if (CheckElementAccess(*obj, index, v8::ACCESS_SET)) { |
| 1032 elms->set(SETTER_INDEX, callbacks->get(1)); | 1032 elms->set(SETTER_INDEX, callbacks->get(1)); |
| 1033 } | 1033 } |
| 1034 break; | 1034 break; |
| 1035 } | 1035 } |
| 1036 case NORMAL: { | 1036 case NORMAL: { |
| 1037 // This is a data property. | 1037 // This is a data property. |
| 1038 elms->set(IS_ACCESSOR_INDEX, heap->false_value()); | 1038 elms->set(IS_ACCESSOR_INDEX, heap->false_value()); |
| 1039 Handle<Object> value = GetElement(obj, index); | 1039 Handle<Object> value = Object::GetElement(obj, index); |
| 1040 ASSERT(!value.is_null()); | 1040 ASSERT(!value.is_null()); |
| 1041 elms->set(VALUE_INDEX, *value); | 1041 elms->set(VALUE_INDEX, *value); |
| 1042 elms->set(WRITABLE_INDEX, heap->ToBoolean(!details.IsReadOnly())); | 1042 elms->set(WRITABLE_INDEX, heap->ToBoolean(!details.IsReadOnly())); |
| 1043 break; | 1043 break; |
| 1044 } | 1044 } |
| 1045 default: | 1045 default: |
| 1046 UNREACHABLE(); | 1046 UNREACHABLE(); |
| 1047 break; | 1047 break; |
| 1048 } | 1048 } |
| 1049 elms->set(ENUMERABLE_INDEX, heap->ToBoolean(!details.IsDontEnum())); | 1049 elms->set(ENUMERABLE_INDEX, heap->ToBoolean(!details.IsDontEnum())); |
| (...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2103 CONVERT_ARG_CHECKED(JSFunction, target, 0); | 2103 CONVERT_ARG_CHECKED(JSFunction, target, 0); |
| 2104 Handle<Object> code = args.at<Object>(1); | 2104 Handle<Object> code = args.at<Object>(1); |
| 2105 | 2105 |
| 2106 Handle<Context> context(target->context()); | 2106 Handle<Context> context(target->context()); |
| 2107 | 2107 |
| 2108 if (!code->IsNull()) { | 2108 if (!code->IsNull()) { |
| 2109 RUNTIME_ASSERT(code->IsJSFunction()); | 2109 RUNTIME_ASSERT(code->IsJSFunction()); |
| 2110 Handle<JSFunction> fun = Handle<JSFunction>::cast(code); | 2110 Handle<JSFunction> fun = Handle<JSFunction>::cast(code); |
| 2111 Handle<SharedFunctionInfo> shared(fun->shared()); | 2111 Handle<SharedFunctionInfo> shared(fun->shared()); |
| 2112 | 2112 |
| 2113 if (!EnsureCompiled(shared, KEEP_EXCEPTION)) { | 2113 if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) { |
| 2114 return Failure::Exception(); | 2114 return Failure::Exception(); |
| 2115 } | 2115 } |
| 2116 // Since we don't store the source for this we should never | 2116 // Since we don't store the source for this we should never |
| 2117 // optimize this. | 2117 // optimize this. |
| 2118 shared->code()->set_optimizable(false); | 2118 shared->code()->set_optimizable(false); |
| 2119 | 2119 |
| 2120 // Set the code, scope info, formal parameter count, | 2120 // Set the code, scope info, formal parameter count, |
| 2121 // and the length of the target function. | 2121 // and the length of the target function. |
| 2122 target->shared()->set_code(shared->code()); | 2122 target->shared()->set_code(shared->code()); |
| 2123 target->ReplaceCode(shared->code()); | 2123 target->ReplaceCode(shared->code()); |
| (...skipping 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4035 Handle<Object> result = | 4035 Handle<Object> result = |
| 4036 GetCharAt(Handle<String>(String::cast(js_value->value())), index); | 4036 GetCharAt(Handle<String>(String::cast(js_value->value())), index); |
| 4037 if (!result->IsUndefined()) return *result; | 4037 if (!result->IsUndefined()) return *result; |
| 4038 } | 4038 } |
| 4039 | 4039 |
| 4040 if (object->IsString() || object->IsNumber() || object->IsBoolean()) { | 4040 if (object->IsString() || object->IsNumber() || object->IsBoolean()) { |
| 4041 Handle<Object> prototype = GetPrototype(object); | 4041 Handle<Object> prototype = GetPrototype(object); |
| 4042 return prototype->GetElement(index); | 4042 return prototype->GetElement(index); |
| 4043 } | 4043 } |
| 4044 | 4044 |
| 4045 return GetElement(object, index); | |
| 4046 } | |
| 4047 | |
| 4048 | |
| 4049 MaybeObject* Runtime::GetElement(Handle<Object> object, uint32_t index) { | |
| 4050 return object->GetElement(index); | 4045 return object->GetElement(index); |
| 4051 } | 4046 } |
| 4052 | 4047 |
| 4053 | 4048 |
| 4054 MaybeObject* Runtime::GetObjectProperty(Isolate* isolate, | 4049 MaybeObject* Runtime::GetObjectProperty(Isolate* isolate, |
| 4055 Handle<Object> object, | 4050 Handle<Object> object, |
| 4056 Handle<Object> key) { | 4051 Handle<Object> key) { |
| 4057 HandleScope scope(isolate); | 4052 HandleScope scope(isolate); |
| 4058 | 4053 |
| 4059 if (object->IsUndefined() || object->IsNull()) { | 4054 if (object->IsUndefined() || object->IsNull()) { |
| (...skipping 4067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8127 // reported the same way whether or not 'Function' is called | 8122 // reported the same way whether or not 'Function' is called |
| 8128 // using 'new'. | 8123 // using 'new'. |
| 8129 return isolate->context()->global(); | 8124 return isolate->context()->global(); |
| 8130 } | 8125 } |
| 8131 } | 8126 } |
| 8132 | 8127 |
| 8133 // The function should be compiled for the optimization hints to be | 8128 // The function should be compiled for the optimization hints to be |
| 8134 // available. We cannot use EnsureCompiled because that forces a | 8129 // available. We cannot use EnsureCompiled because that forces a |
| 8135 // compilation through the shared function info which makes it | 8130 // compilation through the shared function info which makes it |
| 8136 // impossible for us to optimize. | 8131 // impossible for us to optimize. |
| 8132 if (!function->is_compiled()) { | |
| 8133 JSFunction::CompileLazy(function, CLEAR_EXCEPTION); | |
|
ulan
2011/10/19 08:48:12
Do we assume after this line that the function is
| |
| 8134 } | |
| 8135 | |
| 8137 Handle<SharedFunctionInfo> shared(function->shared(), isolate); | 8136 Handle<SharedFunctionInfo> shared(function->shared(), isolate); |
| 8138 if (!function->is_compiled()) CompileLazy(function, CLEAR_EXCEPTION); | |
| 8139 | |
| 8140 if (!function->has_initial_map() && | 8137 if (!function->has_initial_map() && |
| 8141 shared->IsInobjectSlackTrackingInProgress()) { | 8138 shared->IsInobjectSlackTrackingInProgress()) { |
| 8142 // The tracking is already in progress for another function. We can only | 8139 // The tracking is already in progress for another function. We can only |
| 8143 // track one initial_map at a time, so we force the completion before the | 8140 // track one initial_map at a time, so we force the completion before the |
| 8144 // function is called as a constructor for the first time. | 8141 // function is called as a constructor for the first time. |
| 8145 shared->CompleteInobjectSlackTracking(); | 8142 shared->CompleteInobjectSlackTracking(); |
| 8146 } | 8143 } |
| 8147 | 8144 |
| 8148 bool first_allocation = !shared->live_objects_may_exist(); | 8145 bool first_allocation = !shared->live_objects_may_exist(); |
| 8149 Handle<JSObject> result = isolate->factory()->NewJSObject(function); | 8146 Handle<JSObject> result = isolate->factory()->NewJSObject(function); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 8180 #ifdef DEBUG | 8177 #ifdef DEBUG |
| 8181 if (FLAG_trace_lazy && !function->shared()->is_compiled()) { | 8178 if (FLAG_trace_lazy && !function->shared()->is_compiled()) { |
| 8182 PrintF("[lazy: "); | 8179 PrintF("[lazy: "); |
| 8183 function->PrintName(); | 8180 function->PrintName(); |
| 8184 PrintF("]\n"); | 8181 PrintF("]\n"); |
| 8185 } | 8182 } |
| 8186 #endif | 8183 #endif |
| 8187 | 8184 |
| 8188 // Compile the target function. | 8185 // Compile the target function. |
| 8189 ASSERT(!function->is_compiled()); | 8186 ASSERT(!function->is_compiled()); |
| 8190 if (!CompileLazy(function, KEEP_EXCEPTION)) { | 8187 if (!JSFunction::CompileLazy(function, KEEP_EXCEPTION)) { |
| 8191 return Failure::Exception(); | 8188 return Failure::Exception(); |
| 8192 } | 8189 } |
| 8193 | 8190 |
| 8194 // All done. Return the compiled code. | 8191 // All done. Return the compiled code. |
| 8195 ASSERT(function->is_compiled()); | 8192 ASSERT(function->is_compiled()); |
| 8196 return function->code(); | 8193 return function->code(); |
| 8197 } | 8194 } |
| 8198 | 8195 |
| 8199 | 8196 |
| 8200 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { | 8197 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 8217 if (FLAG_trace_opt) { | 8214 if (FLAG_trace_opt) { |
| 8218 PrintF("[failed to optimize "); | 8215 PrintF("[failed to optimize "); |
| 8219 function->PrintName(); | 8216 function->PrintName(); |
| 8220 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", | 8217 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", |
| 8221 function->shared()->code()->optimizable() ? "T" : "F", | 8218 function->shared()->code()->optimizable() ? "T" : "F", |
| 8222 isolate->DebuggerHasBreakPoints() ? "T" : "F"); | 8219 isolate->DebuggerHasBreakPoints() ? "T" : "F"); |
| 8223 } | 8220 } |
| 8224 function->ReplaceCode(function->shared()->code()); | 8221 function->ReplaceCode(function->shared()->code()); |
| 8225 return function->code(); | 8222 return function->code(); |
| 8226 } | 8223 } |
| 8227 if (CompileOptimized(function, AstNode::kNoNumber, CLEAR_EXCEPTION)) { | 8224 if (JSFunction::CompileOptimized(function, |
| 8225 AstNode::kNoNumber, | |
| 8226 CLEAR_EXCEPTION)) { | |
| 8228 return function->code(); | 8227 return function->code(); |
| 8229 } | 8228 } |
| 8230 if (FLAG_trace_opt) { | 8229 if (FLAG_trace_opt) { |
| 8231 PrintF("[failed to optimize "); | 8230 PrintF("[failed to optimize "); |
| 8232 function->PrintName(); | 8231 function->PrintName(); |
| 8233 PrintF(": optimized compilation failed]\n"); | 8232 PrintF(": optimized compilation failed]\n"); |
| 8234 } | 8233 } |
| 8235 function->ReplaceCode(function->shared()->code()); | 8234 function->ReplaceCode(function->shared()->code()); |
| 8236 return function->code(); | 8235 return function->code(); |
| 8237 } | 8236 } |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8458 ASSERT(ast_id != AstNode::kNoNumber); | 8457 ASSERT(ast_id != AstNode::kNoNumber); |
| 8459 if (FLAG_trace_osr) { | 8458 if (FLAG_trace_osr) { |
| 8460 PrintF("[replacing on-stack at AST id %d in ", ast_id); | 8459 PrintF("[replacing on-stack at AST id %d in ", ast_id); |
| 8461 function->PrintName(); | 8460 function->PrintName(); |
| 8462 PrintF("]\n"); | 8461 PrintF("]\n"); |
| 8463 } | 8462 } |
| 8464 | 8463 |
| 8465 // Try to compile the optimized code. A true return value from | 8464 // Try to compile the optimized code. A true return value from |
| 8466 // CompileOptimized means that compilation succeeded, not necessarily | 8465 // CompileOptimized means that compilation succeeded, not necessarily |
| 8467 // that optimization succeeded. | 8466 // that optimization succeeded. |
| 8468 if (CompileOptimized(function, ast_id, CLEAR_EXCEPTION) && | 8467 if (JSFunction::CompileOptimized(function, ast_id, CLEAR_EXCEPTION) && |
| 8469 function->IsOptimized()) { | 8468 function->IsOptimized()) { |
| 8470 DeoptimizationInputData* data = DeoptimizationInputData::cast( | 8469 DeoptimizationInputData* data = DeoptimizationInputData::cast( |
| 8471 function->code()->deoptimization_data()); | 8470 function->code()->deoptimization_data()); |
| 8472 if (data->OsrPcOffset()->value() >= 0) { | 8471 if (data->OsrPcOffset()->value() >= 0) { |
| 8473 if (FLAG_trace_osr) { | 8472 if (FLAG_trace_osr) { |
| 8474 PrintF("[on-stack replacement offset %d in optimized code]\n", | 8473 PrintF("[on-stack replacement offset %d in optimized code]\n", |
| 8475 data->OsrPcOffset()->value()); | 8474 data->OsrPcOffset()->value()); |
| 8476 } | 8475 } |
| 8477 ASSERT(data->OsrAstId()->value() == ast_id); | 8476 ASSERT(data->OsrAstId()->value() == ast_id); |
| 8478 } else { | 8477 } else { |
| (...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9833 int fast_length = static_cast<int>(length); | 9832 int fast_length = static_cast<int>(length); |
| 9834 ASSERT(fast_length <= elements->length()); | 9833 ASSERT(fast_length <= elements->length()); |
| 9835 for (int j = 0; j < fast_length; j++) { | 9834 for (int j = 0; j < fast_length; j++) { |
| 9836 HandleScope loop_scope(isolate); | 9835 HandleScope loop_scope(isolate); |
| 9837 Handle<Object> element_value(elements->get(j), isolate); | 9836 Handle<Object> element_value(elements->get(j), isolate); |
| 9838 if (!element_value->IsTheHole()) { | 9837 if (!element_value->IsTheHole()) { |
| 9839 visitor->visit(j, element_value); | 9838 visitor->visit(j, element_value); |
| 9840 } else if (receiver->HasElement(j)) { | 9839 } else if (receiver->HasElement(j)) { |
| 9841 // Call GetElement on receiver, not its prototype, or getters won't | 9840 // Call GetElement on receiver, not its prototype, or getters won't |
| 9842 // have the correct receiver. | 9841 // have the correct receiver. |
| 9843 element_value = GetElement(receiver, j); | 9842 element_value = Object::GetElement(receiver, j); |
| 9844 if (element_value.is_null()) return false; | 9843 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, element_value, false); |
| 9845 visitor->visit(j, element_value); | 9844 visitor->visit(j, element_value); |
| 9846 } | 9845 } |
| 9847 } | 9846 } |
| 9848 break; | 9847 break; |
| 9849 } | 9848 } |
| 9850 case DICTIONARY_ELEMENTS: { | 9849 case DICTIONARY_ELEMENTS: { |
| 9851 Handle<NumberDictionary> dict(receiver->element_dictionary()); | 9850 Handle<NumberDictionary> dict(receiver->element_dictionary()); |
| 9852 List<uint32_t> indices(dict->Capacity() / 2); | 9851 List<uint32_t> indices(dict->Capacity() / 2); |
| 9853 // Collect all indices in the object and the prototypes less | 9852 // Collect all indices in the object and the prototypes less |
| 9854 // than length. This might introduce duplicates in the indices list. | 9853 // than length. This might introduce duplicates in the indices list. |
| 9855 CollectElementIndices(receiver, length, &indices); | 9854 CollectElementIndices(receiver, length, &indices); |
| 9856 indices.Sort(&compareUInt32); | 9855 indices.Sort(&compareUInt32); |
| 9857 int j = 0; | 9856 int j = 0; |
| 9858 int n = indices.length(); | 9857 int n = indices.length(); |
| 9859 while (j < n) { | 9858 while (j < n) { |
| 9860 HandleScope loop_scope; | 9859 HandleScope loop_scope; |
| 9861 uint32_t index = indices[j]; | 9860 uint32_t index = indices[j]; |
| 9862 Handle<Object> element = GetElement(receiver, index); | 9861 Handle<Object> element = Object::GetElement(receiver, index); |
| 9863 if (element.is_null()) return false; | 9862 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, element, false); |
| 9864 visitor->visit(index, element); | 9863 visitor->visit(index, element); |
| 9865 // Skip to next different index (i.e., omit duplicates). | 9864 // Skip to next different index (i.e., omit duplicates). |
| 9866 do { | 9865 do { |
| 9867 j++; | 9866 j++; |
| 9868 } while (j < n && indices[j] == index); | 9867 } while (j < n && indices[j] == index); |
| 9869 } | 9868 } |
| 9870 break; | 9869 break; |
| 9871 } | 9870 } |
| 9872 case EXTERNAL_PIXEL_ELEMENTS: { | 9871 case EXTERNAL_PIXEL_ELEMENTS: { |
| 9873 Handle<ExternalPixelArray> pixels(ExternalPixelArray::cast( | 9872 Handle<ExternalPixelArray> pixels(ExternalPixelArray::cast( |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10103 Handle<Object> key1 = args.at<Object>(1); | 10102 Handle<Object> key1 = args.at<Object>(1); |
| 10104 Handle<Object> key2 = args.at<Object>(2); | 10103 Handle<Object> key2 = args.at<Object>(2); |
| 10105 | 10104 |
| 10106 uint32_t index1, index2; | 10105 uint32_t index1, index2; |
| 10107 if (!key1->ToArrayIndex(&index1) | 10106 if (!key1->ToArrayIndex(&index1) |
| 10108 || !key2->ToArrayIndex(&index2)) { | 10107 || !key2->ToArrayIndex(&index2)) { |
| 10109 return isolate->ThrowIllegalOperation(); | 10108 return isolate->ThrowIllegalOperation(); |
| 10110 } | 10109 } |
| 10111 | 10110 |
| 10112 Handle<JSObject> jsobject = Handle<JSObject>::cast(object); | 10111 Handle<JSObject> jsobject = Handle<JSObject>::cast(object); |
| 10113 Handle<Object> tmp1 = GetElement(jsobject, index1); | 10112 Handle<Object> tmp1 = Object::GetElement(jsobject, index1); |
| 10114 RETURN_IF_EMPTY_HANDLE(isolate, tmp1); | 10113 RETURN_IF_EMPTY_HANDLE(isolate, tmp1); |
| 10115 Handle<Object> tmp2 = GetElement(jsobject, index2); | 10114 Handle<Object> tmp2 = Object::GetElement(jsobject, index2); |
| 10116 RETURN_IF_EMPTY_HANDLE(isolate, tmp2); | 10115 RETURN_IF_EMPTY_HANDLE(isolate, tmp2); |
| 10117 | 10116 |
| 10118 RETURN_IF_EMPTY_HANDLE(isolate, | 10117 RETURN_IF_EMPTY_HANDLE(isolate, |
| 10119 SetElement(jsobject, index1, tmp2, kStrictMode)); | 10118 SetElement(jsobject, index1, tmp2, kStrictMode)); |
| 10120 RETURN_IF_EMPTY_HANDLE(isolate, | 10119 RETURN_IF_EMPTY_HANDLE(isolate, |
| 10121 SetElement(jsobject, index2, tmp1, kStrictMode)); | 10120 SetElement(jsobject, index2, tmp1, kStrictMode)); |
| 10122 | 10121 |
| 10123 return isolate->heap()->undefined_value(); | 10122 return isolate->heap()->undefined_value(); |
| 10124 } | 10123 } |
| 10125 | 10124 |
| (...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11615 return isolate->heap()->undefined_value(); | 11614 return isolate->heap()->undefined_value(); |
| 11616 } | 11615 } |
| 11617 | 11616 |
| 11618 // If the candidate found is compiled we are done. NOTE: when lazy | 11617 // If the candidate found is compiled we are done. NOTE: when lazy |
| 11619 // compilation of inner functions is introduced some additional checking | 11618 // compilation of inner functions is introduced some additional checking |
| 11620 // needs to be done here to compile inner functions. | 11619 // needs to be done here to compile inner functions. |
| 11621 done = target->is_compiled(); | 11620 done = target->is_compiled(); |
| 11622 if (!done) { | 11621 if (!done) { |
| 11623 // If the candidate is not compiled compile it to reveal any inner | 11622 // If the candidate is not compiled compile it to reveal any inner |
| 11624 // functions which might contain the requested source position. | 11623 // functions which might contain the requested source position. |
| 11625 CompileLazyShared(target, KEEP_EXCEPTION); | 11624 SharedFunctionInfo::CompileLazy(target, KEEP_EXCEPTION); |
| 11626 } | 11625 } |
| 11627 } // End while loop. | 11626 } // End while loop. |
| 11628 | 11627 |
| 11629 return *target; | 11628 return *target; |
| 11630 } | 11629 } |
| 11631 | 11630 |
| 11632 | 11631 |
| 11633 // Changes the state of a break point in a script and returns source position | 11632 // Changes the state of a break point in a script and returns source position |
| 11634 // where break point was set. NOTE: Regarding performance see the NOTE for | 11633 // where break point was set. NOTE: Regarding performance see the NOTE for |
| 11635 // GetScriptFromScriptData. | 11634 // GetScriptFromScriptData. |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12362 } | 12361 } |
| 12363 | 12362 |
| 12364 | 12363 |
| 12365 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) { | 12364 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) { |
| 12366 #ifdef DEBUG | 12365 #ifdef DEBUG |
| 12367 HandleScope scope(isolate); | 12366 HandleScope scope(isolate); |
| 12368 ASSERT(args.length() == 1); | 12367 ASSERT(args.length() == 1); |
| 12369 // Get the function and make sure it is compiled. | 12368 // Get the function and make sure it is compiled. |
| 12370 CONVERT_ARG_CHECKED(JSFunction, func, 0); | 12369 CONVERT_ARG_CHECKED(JSFunction, func, 0); |
| 12371 Handle<SharedFunctionInfo> shared(func->shared()); | 12370 Handle<SharedFunctionInfo> shared(func->shared()); |
| 12372 if (!EnsureCompiled(shared, KEEP_EXCEPTION)) { | 12371 if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) { |
| 12373 return Failure::Exception(); | 12372 return Failure::Exception(); |
| 12374 } | 12373 } |
| 12375 func->code()->PrintLn(); | 12374 func->code()->PrintLn(); |
| 12376 #endif // DEBUG | 12375 #endif // DEBUG |
| 12377 return isolate->heap()->undefined_value(); | 12376 return isolate->heap()->undefined_value(); |
| 12378 } | 12377 } |
| 12379 | 12378 |
| 12380 | 12379 |
| 12381 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleConstructor) { | 12380 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleConstructor) { |
| 12382 #ifdef DEBUG | 12381 #ifdef DEBUG |
| 12383 HandleScope scope(isolate); | 12382 HandleScope scope(isolate); |
| 12384 ASSERT(args.length() == 1); | 12383 ASSERT(args.length() == 1); |
| 12385 // Get the function and make sure it is compiled. | 12384 // Get the function and make sure it is compiled. |
| 12386 CONVERT_ARG_CHECKED(JSFunction, func, 0); | 12385 CONVERT_ARG_CHECKED(JSFunction, func, 0); |
| 12387 Handle<SharedFunctionInfo> shared(func->shared()); | 12386 Handle<SharedFunctionInfo> shared(func->shared()); |
| 12388 if (!EnsureCompiled(shared, KEEP_EXCEPTION)) { | 12387 if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) { |
| 12389 return Failure::Exception(); | 12388 return Failure::Exception(); |
| 12390 } | 12389 } |
| 12391 shared->construct_stub()->PrintLn(); | 12390 shared->construct_stub()->PrintLn(); |
| 12392 #endif // DEBUG | 12391 #endif // DEBUG |
| 12393 return isolate->heap()->undefined_value(); | 12392 return isolate->heap()->undefined_value(); |
| 12394 } | 12393 } |
| 12395 | 12394 |
| 12396 | 12395 |
| 12397 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetInferredName) { | 12396 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionGetInferredName) { |
| 12398 NoHandleAllocation ha; | 12397 NoHandleAllocation ha; |
| (...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13412 } else { | 13411 } else { |
| 13413 // Handle last resort GC and make sure to allow future allocations | 13412 // Handle last resort GC and make sure to allow future allocations |
| 13414 // to grow the heap without causing GCs (if possible). | 13413 // to grow the heap without causing GCs (if possible). |
| 13415 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13414 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13416 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13415 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
| 13417 } | 13416 } |
| 13418 } | 13417 } |
| 13419 | 13418 |
| 13420 | 13419 |
| 13421 } } // namespace v8::internal | 13420 } } // namespace v8::internal |
| OLD | NEW |