Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1181 return isolate->heap()->ToBoolean(obj->map()->is_extensible()); | 1181 return isolate->heap()->ToBoolean(obj->map()->is_extensible()); |
| 1182 } | 1182 } |
| 1183 | 1183 |
| 1184 | 1184 |
| 1185 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) { | 1185 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) { |
| 1186 HandleScope scope(isolate); | 1186 HandleScope scope(isolate); |
| 1187 ASSERT(args.length() == 3); | 1187 ASSERT(args.length() == 3); |
| 1188 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, re, 0); | 1188 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, re, 0); |
| 1189 CONVERT_ARG_HANDLE_CHECKED(String, pattern, 1); | 1189 CONVERT_ARG_HANDLE_CHECKED(String, pattern, 1); |
| 1190 CONVERT_ARG_HANDLE_CHECKED(String, flags, 2); | 1190 CONVERT_ARG_HANDLE_CHECKED(String, flags, 2); |
| 1191 Handle<Object> result = RegExpImpl::Compile(re, pattern, flags); | 1191 Handle<Object> result = |
| 1192 RegExpImpl::Compile(re, pattern, flags, isolate->runtime_zone()); | |
| 1192 if (result.is_null()) return Failure::Exception(); | 1193 if (result.is_null()) return Failure::Exception(); |
| 1193 return *result; | 1194 return *result; |
| 1194 } | 1195 } |
| 1195 | 1196 |
| 1196 | 1197 |
| 1197 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateApiFunction) { | 1198 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateApiFunction) { |
| 1198 HandleScope scope(isolate); | 1199 HandleScope scope(isolate); |
| 1199 ASSERT(args.length() == 1); | 1200 ASSERT(args.length() == 1); |
| 1200 CONVERT_ARG_HANDLE_CHECKED(FunctionTemplateInfo, data, 0); | 1201 CONVERT_ARG_HANDLE_CHECKED(FunctionTemplateInfo, data, 0); |
| 1201 return *isolate->factory()->CreateApiFunction(data); | 1202 return *isolate->factory()->CreateApiFunction(data); |
| (...skipping 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2987 MUST_USE_RESULT static MaybeObject* StringReplaceAtomRegExpWithString( | 2988 MUST_USE_RESULT static MaybeObject* StringReplaceAtomRegExpWithString( |
| 2988 Isolate* isolate, | 2989 Isolate* isolate, |
| 2989 Handle<String> subject, | 2990 Handle<String> subject, |
| 2990 Handle<JSRegExp> pattern_regexp, | 2991 Handle<JSRegExp> pattern_regexp, |
| 2991 Handle<String> replacement, | 2992 Handle<String> replacement, |
| 2992 Handle<JSArray> last_match_info, | 2993 Handle<JSArray> last_match_info, |
| 2993 Zone* zone) { | 2994 Zone* zone) { |
| 2994 ASSERT(subject->IsFlat()); | 2995 ASSERT(subject->IsFlat()); |
| 2995 ASSERT(replacement->IsFlat()); | 2996 ASSERT(replacement->IsFlat()); |
| 2996 | 2997 |
| 2997 ZoneScope zone_space(isolate, DELETE_ON_EXIT); | 2998 ZoneScope zone_space(isolate->runtime_zone(), DELETE_ON_EXIT); |
| 2998 ZoneList<int> indices(8, isolate->zone()); | 2999 ZoneList<int> indices(8, isolate->runtime_zone()); |
| 2999 ASSERT_EQ(JSRegExp::ATOM, pattern_regexp->TypeTag()); | 3000 ASSERT_EQ(JSRegExp::ATOM, pattern_regexp->TypeTag()); |
| 3000 String* pattern = | 3001 String* pattern = |
| 3001 String::cast(pattern_regexp->DataAt(JSRegExp::kAtomPatternIndex)); | 3002 String::cast(pattern_regexp->DataAt(JSRegExp::kAtomPatternIndex)); |
| 3002 int subject_len = subject->length(); | 3003 int subject_len = subject->length(); |
| 3003 int pattern_len = pattern->length(); | 3004 int pattern_len = pattern->length(); |
| 3004 int replacement_len = replacement->length(); | 3005 int replacement_len = replacement->length(); |
| 3005 | 3006 |
| 3006 FindStringIndicesDispatch(isolate, *subject, pattern, &indices, 0xffffffff, | 3007 FindStringIndicesDispatch(isolate, *subject, pattern, &indices, 0xffffffff, |
| 3007 zone); | 3008 zone); |
| 3008 | 3009 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3092 if (match.is_null()) { | 3093 if (match.is_null()) { |
| 3093 return Failure::Exception(); | 3094 return Failure::Exception(); |
| 3094 } | 3095 } |
| 3095 if (match->IsNull()) { | 3096 if (match->IsNull()) { |
| 3096 return *subject_handle; | 3097 return *subject_handle; |
| 3097 } | 3098 } |
| 3098 | 3099 |
| 3099 int capture_count = regexp_handle->CaptureCount(); | 3100 int capture_count = regexp_handle->CaptureCount(); |
| 3100 | 3101 |
| 3101 // CompiledReplacement uses zone allocation. | 3102 // CompiledReplacement uses zone allocation. |
| 3102 ZoneScope zonescope(isolate, DELETE_ON_EXIT); | 3103 ZoneScope zonescope(zone, DELETE_ON_EXIT); |
| 3103 CompiledReplacement compiled_replacement(isolate->zone()); | 3104 CompiledReplacement compiled_replacement(zone); |
| 3104 compiled_replacement.Compile(replacement_handle, | 3105 compiled_replacement.Compile(replacement_handle, |
| 3105 capture_count, | 3106 capture_count, |
| 3106 length); | 3107 length); |
| 3107 | 3108 |
| 3108 bool is_global = regexp_handle->GetFlags().is_global(); | 3109 bool is_global = regexp_handle->GetFlags().is_global(); |
| 3109 | 3110 |
| 3110 // Shortcut for simple non-regexp global replacements | 3111 // Shortcut for simple non-regexp global replacements |
| 3111 if (is_global && | 3112 if (is_global && |
| 3112 regexp_handle->TypeTag() == JSRegExp::ATOM && | 3113 regexp_handle->TypeTag() == JSRegExp::ATOM && |
| 3113 compiled_replacement.simple_hint()) { | 3114 compiled_replacement.simple_hint()) { |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3388 } | 3389 } |
| 3389 } | 3390 } |
| 3390 replacement = String::cast(flat_replacement); | 3391 replacement = String::cast(flat_replacement); |
| 3391 } | 3392 } |
| 3392 | 3393 |
| 3393 CONVERT_ARG_CHECKED(JSRegExp, regexp, 1); | 3394 CONVERT_ARG_CHECKED(JSRegExp, regexp, 1); |
| 3394 CONVERT_ARG_CHECKED(JSArray, last_match_info, 3); | 3395 CONVERT_ARG_CHECKED(JSArray, last_match_info, 3); |
| 3395 | 3396 |
| 3396 ASSERT(last_match_info->HasFastObjectElements()); | 3397 ASSERT(last_match_info->HasFastObjectElements()); |
| 3397 | 3398 |
| 3398 Zone* zone = isolate->zone(); | 3399 Zone* zone = isolate->runtime_zone(); |
| 3399 if (replacement->length() == 0) { | 3400 if (replacement->length() == 0) { |
| 3400 if (subject->HasOnlyAsciiChars()) { | 3401 if (subject->HasOnlyAsciiChars()) { |
| 3401 return StringReplaceRegExpWithEmptyString<SeqAsciiString>( | 3402 return StringReplaceRegExpWithEmptyString<SeqAsciiString>( |
| 3402 isolate, subject, regexp, last_match_info, zone); | 3403 isolate, subject, regexp, last_match_info, zone); |
| 3403 } else { | 3404 } else { |
| 3404 return StringReplaceRegExpWithEmptyString<SeqTwoByteString>( | 3405 return StringReplaceRegExpWithEmptyString<SeqTwoByteString>( |
| 3405 isolate, subject, regexp, last_match_info, zone); | 3406 isolate, subject, regexp, last_match_info, zone); |
| 3406 } | 3407 } |
| 3407 } | 3408 } |
| 3408 | 3409 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3737 Handle<Object> match = RegExpImpl::Exec(regexp, subject, 0, regexp_info); | 3738 Handle<Object> match = RegExpImpl::Exec(regexp, subject, 0, regexp_info); |
| 3738 | 3739 |
| 3739 if (match.is_null()) { | 3740 if (match.is_null()) { |
| 3740 return Failure::Exception(); | 3741 return Failure::Exception(); |
| 3741 } | 3742 } |
| 3742 if (match->IsNull()) { | 3743 if (match->IsNull()) { |
| 3743 return isolate->heap()->null_value(); | 3744 return isolate->heap()->null_value(); |
| 3744 } | 3745 } |
| 3745 int length = subject->length(); | 3746 int length = subject->length(); |
| 3746 | 3747 |
| 3747 Zone* zone = isolate->zone(); | 3748 Zone* zone = isolate->runtime_zone(); |
| 3748 ZoneScope zone_space(isolate, DELETE_ON_EXIT); | 3749 ZoneScope zone_space(zone, DELETE_ON_EXIT); |
| 3749 ZoneList<int> offsets(8, zone); | 3750 ZoneList<int> offsets(8, zone); |
| 3750 int start; | 3751 int start; |
| 3751 int end; | 3752 int end; |
| 3752 do { | 3753 do { |
| 3753 { | 3754 { |
| 3754 AssertNoAllocation no_alloc; | 3755 AssertNoAllocation no_alloc; |
| 3755 FixedArray* elements = FixedArray::cast(regexp_info->elements()); | 3756 FixedArray* elements = FixedArray::cast(regexp_info->elements()); |
| 3756 start = Smi::cast(elements->get(RegExpImpl::kFirstCapture))->value(); | 3757 start = Smi::cast(elements->get(RegExpImpl::kFirstCapture))->value(); |
| 3757 end = Smi::cast(elements->get(RegExpImpl::kFirstCapture + 1))->value(); | 3758 end = Smi::cast(elements->get(RegExpImpl::kFirstCapture + 1))->value(); |
| 3758 } | 3759 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3932 } | 3933 } |
| 3933 | 3934 |
| 3934 | 3935 |
| 3935 // Only called from Runtime_RegExpExecMultiple so it doesn't need to maintain | 3936 // Only called from Runtime_RegExpExecMultiple so it doesn't need to maintain |
| 3936 // separate last match info. See comment on that function. | 3937 // separate last match info. See comment on that function. |
| 3937 static int SearchRegExpMultiple( | 3938 static int SearchRegExpMultiple( |
| 3938 Isolate* isolate, | 3939 Isolate* isolate, |
| 3939 Handle<String> subject, | 3940 Handle<String> subject, |
| 3940 Handle<JSRegExp> regexp, | 3941 Handle<JSRegExp> regexp, |
| 3941 Handle<JSArray> last_match_array, | 3942 Handle<JSArray> last_match_array, |
| 3942 FixedArrayBuilder* builder) { | 3943 FixedArrayBuilder* builder, |
| 3944 Zone* zone) { | |
| 3943 | 3945 |
| 3944 ASSERT(subject->IsFlat()); | 3946 ASSERT(subject->IsFlat()); |
| 3945 int registers_per_match = RegExpImpl::IrregexpPrepare(regexp, subject); | 3947 int registers_per_match = RegExpImpl::IrregexpPrepare(regexp, subject); |
| 3946 if (registers_per_match < 0) return RegExpImpl::RE_EXCEPTION; | 3948 if (registers_per_match < 0) return RegExpImpl::RE_EXCEPTION; |
| 3947 | 3949 |
| 3948 int max_matches; | 3950 int max_matches; |
| 3949 int num_registers = RegExpImpl::GlobalOffsetsVectorSize(regexp, | 3951 int num_registers = RegExpImpl::GlobalOffsetsVectorSize(regexp, |
| 3950 registers_per_match, | 3952 registers_per_match, |
| 3951 &max_matches); | 3953 &max_matches); |
| 3952 OffsetsVector registers(num_registers, isolate); | 3954 OffsetsVector registers(num_registers, isolate); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4115 result = SearchRegExpNoCaptureMultiple(isolate, | 4117 result = SearchRegExpNoCaptureMultiple(isolate, |
| 4116 subject, | 4118 subject, |
| 4117 regexp, | 4119 regexp, |
| 4118 last_match_info, | 4120 last_match_info, |
| 4119 &builder); | 4121 &builder); |
| 4120 } else { | 4122 } else { |
| 4121 result = SearchRegExpMultiple(isolate, | 4123 result = SearchRegExpMultiple(isolate, |
| 4122 subject, | 4124 subject, |
| 4123 regexp, | 4125 regexp, |
| 4124 last_match_info, | 4126 last_match_info, |
| 4125 &builder); | 4127 &builder, |
| 4128 isolate->runtime_zone()); | |
| 4126 } | 4129 } |
| 4127 if (result == RegExpImpl::RE_SUCCESS) return *builder.ToJSArray(result_array); | 4130 if (result == RegExpImpl::RE_SUCCESS) return *builder.ToJSArray(result_array); |
| 4128 if (result == RegExpImpl::RE_FAILURE) return isolate->heap()->null_value(); | 4131 if (result == RegExpImpl::RE_FAILURE) return isolate->heap()->null_value(); |
| 4129 ASSERT_EQ(result, RegExpImpl::RE_EXCEPTION); | 4132 ASSERT_EQ(result, RegExpImpl::RE_EXCEPTION); |
| 4130 return Failure::Exception(); | 4133 return Failure::Exception(); |
| 4131 } | 4134 } |
| 4132 | 4135 |
| 4133 | 4136 |
| 4134 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToRadixString) { | 4137 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToRadixString) { |
| 4135 NoHandleAllocation ha; | 4138 NoHandleAllocation ha; |
| (...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6450 } | 6453 } |
| 6451 | 6454 |
| 6452 // The limit can be very large (0xffffffffu), but since the pattern | 6455 // The limit can be very large (0xffffffffu), but since the pattern |
| 6453 // isn't empty, we can never create more parts than ~half the length | 6456 // isn't empty, we can never create more parts than ~half the length |
| 6454 // of the subject. | 6457 // of the subject. |
| 6455 | 6458 |
| 6456 if (!subject->IsFlat()) FlattenString(subject); | 6459 if (!subject->IsFlat()) FlattenString(subject); |
| 6457 | 6460 |
| 6458 static const int kMaxInitialListCapacity = 16; | 6461 static const int kMaxInitialListCapacity = 16; |
| 6459 | 6462 |
| 6460 Zone* zone = isolate->zone(); | 6463 Zone* zone = isolate->runtime_zone(); |
| 6461 ZoneScope scope(isolate, DELETE_ON_EXIT); | 6464 ZoneScope scope(zone, DELETE_ON_EXIT); |
| 6462 | 6465 |
| 6463 // Find (up to limit) indices of separator and end-of-string in subject | 6466 // Find (up to limit) indices of separator and end-of-string in subject |
| 6464 int initial_capacity = Min<uint32_t>(kMaxInitialListCapacity, limit); | 6467 int initial_capacity = Min<uint32_t>(kMaxInitialListCapacity, limit); |
| 6465 ZoneList<int> indices(initial_capacity, zone); | 6468 ZoneList<int> indices(initial_capacity, zone); |
| 6466 if (!pattern->IsFlat()) FlattenString(pattern); | 6469 if (!pattern->IsFlat()) FlattenString(pattern); |
| 6467 | 6470 |
| 6468 FindStringIndicesDispatch(isolate, *subject, *pattern, &indices, limit, zone); | 6471 FindStringIndicesDispatch(isolate, *subject, *pattern, &indices, limit, zone); |
| 6469 | 6472 |
| 6470 if (static_cast<uint32_t>(indices.length()) < limit) { | 6473 if (static_cast<uint32_t>(indices.length()) < limit) { |
| 6471 indices.Add(subject_length, zone); | 6474 indices.Add(subject_length, zone); |
| (...skipping 2831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9303 if (!global->IsJSGlobalObject()) return isolate->heap()->null_value(); | 9306 if (!global->IsJSGlobalObject()) return isolate->heap()->null_value(); |
| 9304 return JSGlobalObject::cast(global)->global_receiver(); | 9307 return JSGlobalObject::cast(global)->global_receiver(); |
| 9305 } | 9308 } |
| 9306 | 9309 |
| 9307 | 9310 |
| 9308 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParseJson) { | 9311 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParseJson) { |
| 9309 HandleScope scope(isolate); | 9312 HandleScope scope(isolate); |
| 9310 ASSERT_EQ(1, args.length()); | 9313 ASSERT_EQ(1, args.length()); |
| 9311 CONVERT_ARG_HANDLE_CHECKED(String, source, 0); | 9314 CONVERT_ARG_HANDLE_CHECKED(String, source, 0); |
| 9312 | 9315 |
| 9313 Zone* zone = isolate->zone(); | 9316 Zone* zone = isolate->runtime_zone(); |
| 9314 source = Handle<String>(source->TryFlattenGetString()); | 9317 source = Handle<String>(source->TryFlattenGetString()); |
| 9315 // Optimized fast case where we only have ASCII characters. | 9318 // Optimized fast case where we only have ASCII characters. |
| 9316 Handle<Object> result; | 9319 Handle<Object> result; |
| 9317 if (source->IsSeqAsciiString()) { | 9320 if (source->IsSeqAsciiString()) { |
| 9318 result = JsonParser<true>::Parse(source, zone); | 9321 result = JsonParser<true>::Parse(source, zone); |
| 9319 } else { | 9322 } else { |
| 9320 result = JsonParser<false>::Parse(source, zone); | 9323 result = JsonParser<false>::Parse(source, zone); |
| 9321 } | 9324 } |
| 9322 if (result.is_null()) { | 9325 if (result.is_null()) { |
| 9323 // Syntax error or stack overflow in scanner. | 9326 // Syntax error or stack overflow in scanner. |
| (...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11134 ScopeIterator(Isolate* isolate, | 11137 ScopeIterator(Isolate* isolate, |
| 11135 JavaScriptFrame* frame, | 11138 JavaScriptFrame* frame, |
| 11136 int inlined_jsframe_index) | 11139 int inlined_jsframe_index) |
| 11137 : isolate_(isolate), | 11140 : isolate_(isolate), |
| 11138 frame_(frame), | 11141 frame_(frame), |
| 11139 inlined_jsframe_index_(inlined_jsframe_index), | 11142 inlined_jsframe_index_(inlined_jsframe_index), |
| 11140 function_(JSFunction::cast(frame->function())), | 11143 function_(JSFunction::cast(frame->function())), |
| 11141 context_(Context::cast(frame->context())), | 11144 context_(Context::cast(frame->context())), |
| 11142 nested_scope_chain_(4) { | 11145 nested_scope_chain_(4) { |
| 11143 | 11146 |
| 11147 Zone zone(isolate); | |
| 11148 ZoneScope zone_scope(&zone, DELETE_ON_EXIT); | |
| 11144 // Catch the case when the debugger stops in an internal function. | 11149 // Catch the case when the debugger stops in an internal function. |
| 11145 Handle<SharedFunctionInfo> shared_info(function_->shared()); | 11150 Handle<SharedFunctionInfo> shared_info(function_->shared()); |
| 11146 Handle<ScopeInfo> scope_info(shared_info->scope_info()); | 11151 Handle<ScopeInfo> scope_info(shared_info->scope_info()); |
| 11147 if (shared_info->script() == isolate->heap()->undefined_value()) { | 11152 if (shared_info->script() == isolate->heap()->undefined_value()) { |
| 11148 while (context_->closure() == *function_) { | 11153 while (context_->closure() == *function_) { |
| 11149 context_ = Handle<Context>(context_->previous(), isolate_); | 11154 context_ = Handle<Context>(context_->previous(), isolate_); |
| 11150 } | 11155 } |
| 11151 return; | 11156 return; |
| 11152 } | 11157 } |
| 11153 | 11158 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 11170 if (scope_info->HasContext()) { | 11175 if (scope_info->HasContext()) { |
| 11171 context_ = Handle<Context>(context_->declaration_context(), isolate_); | 11176 context_ = Handle<Context>(context_->declaration_context(), isolate_); |
| 11172 } else { | 11177 } else { |
| 11173 while (context_->closure() == *function_) { | 11178 while (context_->closure() == *function_) { |
| 11174 context_ = Handle<Context>(context_->previous(), isolate_); | 11179 context_ = Handle<Context>(context_->previous(), isolate_); |
| 11175 } | 11180 } |
| 11176 } | 11181 } |
| 11177 if (scope_info->Type() != EVAL_SCOPE) nested_scope_chain_.Add(scope_info); | 11182 if (scope_info->Type() != EVAL_SCOPE) nested_scope_chain_.Add(scope_info); |
| 11178 } else { | 11183 } else { |
| 11179 // Reparse the code and analyze the scopes. | 11184 // Reparse the code and analyze the scopes. |
| 11180 ZoneScope zone_scope(isolate, DELETE_ON_EXIT); | |
| 11181 Handle<Script> script(Script::cast(shared_info->script())); | 11185 Handle<Script> script(Script::cast(shared_info->script())); |
| 11182 Scope* scope = NULL; | 11186 Scope* scope = NULL; |
| 11183 | 11187 |
| 11184 // Check whether we are in global, eval or function code. | 11188 // Check whether we are in global, eval or function code. |
| 11185 Handle<ScopeInfo> scope_info(shared_info->scope_info()); | 11189 Handle<ScopeInfo> scope_info(shared_info->scope_info()); |
| 11186 if (scope_info->Type() != FUNCTION_SCOPE) { | 11190 if (scope_info->Type() != FUNCTION_SCOPE) { |
| 11187 // Global or eval code. | 11191 // Global or eval code. |
| 11188 CompilationInfo info(script); | 11192 CompilationInfo info(script, &zone); |
| 11189 if (scope_info->Type() == GLOBAL_SCOPE) { | 11193 if (scope_info->Type() == GLOBAL_SCOPE) { |
| 11190 info.MarkAsGlobal(); | 11194 info.MarkAsGlobal(); |
| 11191 } else { | 11195 } else { |
| 11192 ASSERT(scope_info->Type() == EVAL_SCOPE); | 11196 ASSERT(scope_info->Type() == EVAL_SCOPE); |
| 11193 info.MarkAsEval(); | 11197 info.MarkAsEval(); |
| 11194 info.SetCallingContext(Handle<Context>(function_->context())); | 11198 info.SetCallingContext(Handle<Context>(function_->context())); |
| 11195 } | 11199 } |
| 11196 if (ParserApi::Parse(&info, kNoParsingFlags) && Scope::Analyze(&info)) { | 11200 if (ParserApi::Parse(&info, kNoParsingFlags) && Scope::Analyze(&info)) { |
| 11197 scope = info.function()->scope(); | 11201 scope = info.function()->scope(); |
| 11198 } | 11202 } |
| 11199 } else { | 11203 } else { |
| 11200 // Function code | 11204 // Function code |
| 11201 CompilationInfo info(shared_info); | 11205 CompilationInfo info(shared_info, &zone); |
|
danno
2012/06/19 15:24:57
Ass discussed, move zone and zonescope into Compil
| |
| 11202 if (ParserApi::Parse(&info, kNoParsingFlags) && Scope::Analyze(&info)) { | 11206 if (ParserApi::Parse(&info, kNoParsingFlags) && Scope::Analyze(&info)) { |
| 11203 scope = info.function()->scope(); | 11207 scope = info.function()->scope(); |
| 11204 } | 11208 } |
| 11205 } | 11209 } |
| 11206 | 11210 |
| 11207 // Retrieve the scope chain for the current position. | 11211 // Retrieve the scope chain for the current position. |
| 11208 if (scope != NULL) { | 11212 if (scope != NULL) { |
| 11209 int source_position = shared_info->code()->SourcePosition(frame_->pc()); | 11213 int source_position = shared_info->code()->SourcePosition(frame_->pc()); |
| 11210 scope->GetNestedScopeChain(&nested_scope_chain_, source_position); | 11214 scope->GetNestedScopeChain(&nested_scope_chain_, source_position); |
| 11211 } else { | 11215 } else { |
| (...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12766 // checks that none of them have activations on stacks (of any thread). | 12770 // checks that none of them have activations on stacks (of any thread). |
| 12767 // Returns array of the same length with corresponding results of | 12771 // Returns array of the same length with corresponding results of |
| 12768 // LiveEdit::FunctionPatchabilityStatus type. | 12772 // LiveEdit::FunctionPatchabilityStatus type. |
| 12769 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCheckAndDropActivations) { | 12773 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCheckAndDropActivations) { |
| 12770 ASSERT(args.length() == 2); | 12774 ASSERT(args.length() == 2); |
| 12771 HandleScope scope(isolate); | 12775 HandleScope scope(isolate); |
| 12772 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0); | 12776 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0); |
| 12773 CONVERT_BOOLEAN_ARG_CHECKED(do_drop, 1); | 12777 CONVERT_BOOLEAN_ARG_CHECKED(do_drop, 1); |
| 12774 | 12778 |
| 12775 return *LiveEdit::CheckAndDropActivations(shared_array, do_drop, | 12779 return *LiveEdit::CheckAndDropActivations(shared_array, do_drop, |
| 12776 isolate->zone()); | 12780 isolate->runtime_zone()); |
| 12777 } | 12781 } |
| 12778 | 12782 |
| 12779 // Compares 2 strings line-by-line, then token-wise and returns diff in form | 12783 // Compares 2 strings line-by-line, then token-wise and returns diff in form |
| 12780 // of JSArray of triplets (pos1, pos1_end, pos2_end) describing list | 12784 // of JSArray of triplets (pos1, pos1_end, pos2_end) describing list |
| 12781 // of diff chunks. | 12785 // of diff chunks. |
| 12782 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCompareStrings) { | 12786 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCompareStrings) { |
| 12783 ASSERT(args.length() == 2); | 12787 ASSERT(args.length() == 2); |
| 12784 HandleScope scope(isolate); | 12788 HandleScope scope(isolate); |
| 12785 CONVERT_ARG_HANDLE_CHECKED(String, s1, 0); | 12789 CONVERT_ARG_HANDLE_CHECKED(String, s1, 0); |
| 12786 CONVERT_ARG_HANDLE_CHECKED(String, s2, 1); | 12790 CONVERT_ARG_HANDLE_CHECKED(String, s2, 1); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 12813 | 12817 |
| 12814 int count = 0; | 12818 int count = 0; |
| 12815 JavaScriptFrameIterator it(isolate, id); | 12819 JavaScriptFrameIterator it(isolate, id); |
| 12816 for (; !it.done(); it.Advance()) { | 12820 for (; !it.done(); it.Advance()) { |
| 12817 if (index < count + it.frame()->GetInlineCount()) break; | 12821 if (index < count + it.frame()->GetInlineCount()) break; |
| 12818 count += it.frame()->GetInlineCount(); | 12822 count += it.frame()->GetInlineCount(); |
| 12819 } | 12823 } |
| 12820 if (it.done()) return heap->undefined_value(); | 12824 if (it.done()) return heap->undefined_value(); |
| 12821 | 12825 |
| 12822 const char* error_message = | 12826 const char* error_message = |
| 12823 LiveEdit::RestartFrame(it.frame(), isolate->zone()); | 12827 LiveEdit::RestartFrame(it.frame(), isolate->runtime_zone()); |
| 12824 if (error_message) { | 12828 if (error_message) { |
| 12825 return *(isolate->factory()->LookupAsciiSymbol(error_message)); | 12829 return *(isolate->factory()->LookupAsciiSymbol(error_message)); |
| 12826 } | 12830 } |
| 12827 return heap->true_value(); | 12831 return heap->true_value(); |
| 12828 } | 12832 } |
| 12829 | 12833 |
| 12830 | 12834 |
| 12831 // A testing entry. Returns statement position which is the closest to | 12835 // A testing entry. Returns statement position which is the closest to |
| 12832 // source_position. | 12836 // source_position. |
| 12833 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionCodePositionFromSource) { | 12837 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionCodePositionFromSource) { |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13631 // Handle last resort GC and make sure to allow future allocations | 13635 // Handle last resort GC and make sure to allow future allocations |
| 13632 // to grow the heap without causing GCs (if possible). | 13636 // to grow the heap without causing GCs (if possible). |
| 13633 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13637 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13634 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13638 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13635 "Runtime::PerformGC"); | 13639 "Runtime::PerformGC"); |
| 13636 } | 13640 } |
| 13637 } | 13641 } |
| 13638 | 13642 |
| 13639 | 13643 |
| 13640 } } // namespace v8::internal | 13644 } } // namespace v8::internal |
| OLD | NEW |