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 6209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6220 // Type", https://bugs.ecmascript.org/show_bug.cgi?id=1584 | 6220 // Type", https://bugs.ecmascript.org/show_bug.cgi?id=1584 |
6221 flags |= ALLOW_OCTAL | ALLOW_BINARY; | 6221 flags |= ALLOW_OCTAL | ALLOW_BINARY; |
6222 } | 6222 } |
6223 | 6223 |
6224 return *isolate->factory()->NewNumber(StringToDouble( | 6224 return *isolate->factory()->NewNumber(StringToDouble( |
6225 isolate->unicode_cache(), *subject, flags)); | 6225 isolate->unicode_cache(), *subject, flags)); |
6226 } | 6226 } |
6227 | 6227 |
6228 | 6228 |
6229 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewString) { | 6229 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewString) { |
6230 SealHandleScope shs(isolate); | 6230 HandleScope scope(isolate); |
6231 ASSERT(args.length() == 2); | 6231 ASSERT(args.length() == 2); |
6232 CONVERT_SMI_ARG_CHECKED(length, 0); | 6232 CONVERT_SMI_ARG_CHECKED(length, 0); |
6233 CONVERT_BOOLEAN_ARG_CHECKED(is_one_byte, 1); | 6233 CONVERT_BOOLEAN_ARG_CHECKED(is_one_byte, 1); |
6234 if (length == 0) return isolate->heap()->empty_string(); | 6234 if (length == 0) return isolate->heap()->empty_string(); |
| 6235 Handle<String> result; |
6235 if (is_one_byte) { | 6236 if (is_one_byte) { |
6236 return isolate->heap()->AllocateRawOneByteString(length); | 6237 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 6238 isolate, result, isolate->factory()->NewRawOneByteString(length)); |
6237 } else { | 6239 } else { |
6238 return isolate->heap()->AllocateRawTwoByteString(length); | 6240 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 6241 isolate, result, isolate->factory()->NewRawTwoByteString(length)); |
6239 } | 6242 } |
| 6243 return *result; |
6240 } | 6244 } |
6241 | 6245 |
6242 | 6246 |
6243 RUNTIME_FUNCTION(MaybeObject*, Runtime_TruncateString) { | 6247 RUNTIME_FUNCTION(MaybeObject*, Runtime_TruncateString) { |
6244 HandleScope scope(isolate); | 6248 HandleScope scope(isolate); |
6245 ASSERT(args.length() == 2); | 6249 ASSERT(args.length() == 2); |
6246 CONVERT_ARG_HANDLE_CHECKED(SeqString, string, 0); | 6250 CONVERT_ARG_HANDLE_CHECKED(SeqString, string, 0); |
6247 CONVERT_SMI_ARG_CHECKED(new_length, 1); | 6251 CONVERT_SMI_ARG_CHECKED(new_length, 1); |
6248 return *SeqString::Truncate(string, new_length); | 6252 return *SeqString::Truncate(string, new_length); |
6249 } | 6253 } |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6599 DisallowHeapAllocation no_gc; | 6603 DisallowHeapAllocation no_gc; |
6600 String::FlatContent flat_content = s->GetFlatContent(); | 6604 String::FlatContent flat_content = s->GetFlatContent(); |
6601 ASSERT(flat_content.IsFlat()); | 6605 ASSERT(flat_content.IsFlat()); |
6602 bool has_changed_character = false; | 6606 bool has_changed_character = false; |
6603 bool is_ascii = FastAsciiConvert<Converter>( | 6607 bool is_ascii = FastAsciiConvert<Converter>( |
6604 reinterpret_cast<char*>(result->GetChars()), | 6608 reinterpret_cast<char*>(result->GetChars()), |
6605 reinterpret_cast<const char*>(flat_content.ToOneByteVector().start()), | 6609 reinterpret_cast<const char*>(flat_content.ToOneByteVector().start()), |
6606 length, | 6610 length, |
6607 &has_changed_character); | 6611 &has_changed_character); |
6608 // If not ASCII, we discard the result and take the 2 byte path. | 6612 // If not ASCII, we discard the result and take the 2 byte path. |
6609 if (is_ascii) return has_changed_character ? *result : *s; | 6613 if (is_ascii) return has_changed_character ? *result : *s; |
6610 } | 6614 } |
6611 | 6615 |
6612 Handle<SeqString> result; // Same length as input. | 6616 Handle<SeqString> result; // Same length as input. |
6613 if (s->IsOneByteRepresentation()) { | 6617 if (s->IsOneByteRepresentation()) { |
6614 result = isolate->factory()->NewRawOneByteString(length).ToHandleChecked(); | 6618 result = isolate->factory()->NewRawOneByteString(length).ToHandleChecked(); |
6615 } else { | 6619 } else { |
6616 result = isolate->factory()->NewRawTwoByteString(length).ToHandleChecked(); | 6620 result = isolate->factory()->NewRawTwoByteString(length).ToHandleChecked(); |
6617 } | 6621 } |
6618 | 6622 |
6619 MaybeObject* maybe = ConvertCaseHelper(isolate, *s, *result, length, mapping); | 6623 MaybeObject* maybe = ConvertCaseHelper(isolate, *s, *result, length, mapping); |
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8024 return *result; | 8028 return *result; |
8025 } | 8029 } |
8026 | 8030 |
8027 | 8031 |
8028 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewClosureFromStubFailure) { | 8032 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewClosureFromStubFailure) { |
8029 HandleScope scope(isolate); | 8033 HandleScope scope(isolate); |
8030 ASSERT(args.length() == 1); | 8034 ASSERT(args.length() == 1); |
8031 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); | 8035 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); |
8032 Handle<Context> context(isolate->context()); | 8036 Handle<Context> context(isolate->context()); |
8033 PretenureFlag pretenure_flag = NOT_TENURED; | 8037 PretenureFlag pretenure_flag = NOT_TENURED; |
8034 Handle<JSFunction> result = | 8038 return *isolate->factory()->NewFunctionFromSharedFunctionInfo( |
8035 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, | 8039 shared, context, pretenure_flag); |
8036 context, | |
8037 pretenure_flag); | |
8038 return *result; | |
8039 } | 8040 } |
8040 | 8041 |
8041 | 8042 |
8042 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewClosure) { | 8043 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewClosure) { |
8043 HandleScope scope(isolate); | 8044 HandleScope scope(isolate); |
8044 ASSERT(args.length() == 3); | 8045 ASSERT(args.length() == 3); |
8045 CONVERT_ARG_HANDLE_CHECKED(Context, context, 0); | 8046 CONVERT_ARG_HANDLE_CHECKED(Context, context, 0); |
8046 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 1); | 8047 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 1); |
8047 CONVERT_BOOLEAN_ARG_CHECKED(pretenure, 2); | 8048 CONVERT_BOOLEAN_ARG_CHECKED(pretenure, 2); |
8048 | 8049 |
8049 // The caller ensures that we pretenure closures that are assigned | 8050 // The caller ensures that we pretenure closures that are assigned |
8050 // directly to properties. | 8051 // directly to properties. |
8051 PretenureFlag pretenure_flag = pretenure ? TENURED : NOT_TENURED; | 8052 PretenureFlag pretenure_flag = pretenure ? TENURED : NOT_TENURED; |
8052 Handle<JSFunction> result = | 8053 return *isolate->factory()->NewFunctionFromSharedFunctionInfo( |
8053 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, | 8054 shared, context, pretenure_flag); |
8054 context, | |
8055 pretenure_flag); | |
8056 return *result; | |
8057 } | 8055 } |
8058 | 8056 |
8059 | 8057 |
8060 // Find the arguments of the JavaScript function invocation that called | 8058 // Find the arguments of the JavaScript function invocation that called |
8061 // into C++ code. Collect these in a newly allocated array of handles (possibly | 8059 // into C++ code. Collect these in a newly allocated array of handles (possibly |
8062 // prefixed by a number of empty handles). | 8060 // prefixed by a number of empty handles). |
8063 static SmartArrayPointer<Handle<Object> > GetCallerArguments( | 8061 static SmartArrayPointer<Handle<Object> > GetCallerArguments( |
8064 Isolate* isolate, | 8062 Isolate* isolate, |
8065 int prefix_argc, | 8063 int prefix_argc, |
8066 int* total_argc) { | 8064 int* total_argc) { |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8313 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewObjectWithAllocationSite) { | 8311 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewObjectWithAllocationSite) { |
8314 HandleScope scope(isolate); | 8312 HandleScope scope(isolate); |
8315 ASSERT(args.length() == 2); | 8313 ASSERT(args.length() == 2); |
8316 CONVERT_ARG_HANDLE_CHECKED(Object, constructor, 1); | 8314 CONVERT_ARG_HANDLE_CHECKED(Object, constructor, 1); |
8317 CONVERT_ARG_HANDLE_CHECKED(Object, feedback, 0); | 8315 CONVERT_ARG_HANDLE_CHECKED(Object, feedback, 0); |
8318 Handle<AllocationSite> site; | 8316 Handle<AllocationSite> site; |
8319 if (feedback->IsAllocationSite()) { | 8317 if (feedback->IsAllocationSite()) { |
8320 // The feedback can be an AllocationSite or undefined. | 8318 // The feedback can be an AllocationSite or undefined. |
8321 site = Handle<AllocationSite>::cast(feedback); | 8319 site = Handle<AllocationSite>::cast(feedback); |
8322 } | 8320 } |
8323 return Runtime_NewObjectHelper(isolate, | 8321 return Runtime_NewObjectHelper(isolate, constructor, site); |
8324 constructor, | |
8325 site); | |
8326 } | 8322 } |
8327 | 8323 |
8328 | 8324 |
8329 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_FinalizeInstanceSize) { | 8325 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_FinalizeInstanceSize) { |
8330 HandleScope scope(isolate); | 8326 HandleScope scope(isolate); |
8331 ASSERT(args.length() == 1); | 8327 ASSERT(args.length() == 1); |
8332 | 8328 |
8333 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8329 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8334 function->shared()->CompleteInobjectSlackTracking(); | 8330 function->shared()->CompleteInobjectSlackTracking(); |
8335 | 8331 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8527 ASSERT(args.length() == 0); | 8523 ASSERT(args.length() == 0); |
8528 #if defined(USE_SIMULATOR) | 8524 #if defined(USE_SIMULATOR) |
8529 return isolate->heap()->true_value(); | 8525 return isolate->heap()->true_value(); |
8530 #else | 8526 #else |
8531 return isolate->heap()->false_value(); | 8527 return isolate->heap()->false_value(); |
8532 #endif | 8528 #endif |
8533 } | 8529 } |
8534 | 8530 |
8535 | 8531 |
8536 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsConcurrentRecompilationSupported) { | 8532 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsConcurrentRecompilationSupported) { |
8537 HandleScope scope(isolate); | 8533 SealHandleScope shs(isolate); |
8538 ASSERT(args.length() == 0); | |
8539 return isolate->heap()->ToBoolean( | 8534 return isolate->heap()->ToBoolean( |
8540 isolate->concurrent_recompilation_enabled()); | 8535 isolate->concurrent_recompilation_enabled()); |
8541 } | 8536 } |
8542 | 8537 |
8543 | 8538 |
8544 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { | 8539 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { |
8545 HandleScope scope(isolate); | 8540 HandleScope scope(isolate); |
8546 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); | 8541 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); |
8547 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8542 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8548 | 8543 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8908 return *result; | 8903 return *result; |
8909 } | 8904 } |
8910 | 8905 |
8911 | 8906 |
8912 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewFunctionContext) { | 8907 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewFunctionContext) { |
8913 HandleScope scope(isolate); | 8908 HandleScope scope(isolate); |
8914 ASSERT(args.length() == 1); | 8909 ASSERT(args.length() == 1); |
8915 | 8910 |
8916 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8911 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8917 int length = function->shared()->scope_info()->ContextLength(); | 8912 int length = function->shared()->scope_info()->ContextLength(); |
8918 Handle<Context> context = | 8913 return *isolate->factory()->NewFunctionContext(length, function); |
8919 isolate->factory()->NewFunctionContext(length, function); | |
8920 return *context; | |
8921 } | 8914 } |
8922 | 8915 |
8923 | 8916 |
8924 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_PushWithContext) { | 8917 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_PushWithContext) { |
8925 HandleScope scope(isolate); | 8918 HandleScope scope(isolate); |
8926 ASSERT(args.length() == 2); | 8919 ASSERT(args.length() == 2); |
8927 Handle<JSReceiver> extension_object; | 8920 Handle<JSReceiver> extension_object; |
8928 if (args[0]->IsJSReceiver()) { | 8921 if (args[0]->IsJSReceiver()) { |
8929 extension_object = args.at<JSReceiver>(0); | 8922 extension_object = args.at<JSReceiver>(0); |
8930 } else { | 8923 } else { |
(...skipping 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10923 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 10916 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
10924 RUNTIME_ASSERT(obj->HasIndexedInterceptor()); | 10917 RUNTIME_ASSERT(obj->HasIndexedInterceptor()); |
10925 CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]); | 10918 CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]); |
10926 Handle<Object> result; | 10919 Handle<Object> result; |
10927 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 10920 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
10928 isolate, result, JSObject::GetElementWithInterceptor(obj, obj, index)); | 10921 isolate, result, JSObject::GetElementWithInterceptor(obj, obj, index)); |
10929 return *result; | 10922 return *result; |
10930 } | 10923 } |
10931 | 10924 |
10932 | 10925 |
| 10926 static bool CheckExecutionState(Isolate* isolate, int break_id) { |
| 10927 return (isolate->debug()->break_id() != 0 && |
| 10928 break_id == isolate->debug()->break_id()); |
| 10929 } |
| 10930 |
| 10931 |
10933 RUNTIME_FUNCTION(MaybeObject*, Runtime_CheckExecutionState) { | 10932 RUNTIME_FUNCTION(MaybeObject*, Runtime_CheckExecutionState) { |
10934 SealHandleScope shs(isolate); | 10933 SealHandleScope shs(isolate); |
10935 ASSERT(args.length() >= 1); | 10934 ASSERT(args.length() == 1); |
10936 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); | 10935 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
10937 // Check that the break id is valid. | 10936 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
10938 if (isolate->debug()->break_id() == 0 || | |
10939 break_id != isolate->debug()->break_id()) { | |
10940 return isolate->Throw( | |
10941 isolate->heap()->illegal_execution_state_string()); | |
10942 } | |
10943 | |
10944 return isolate->heap()->true_value(); | 10937 return isolate->heap()->true_value(); |
10945 } | 10938 } |
10946 | 10939 |
10947 | 10940 |
10948 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameCount) { | 10941 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameCount) { |
10949 HandleScope scope(isolate); | 10942 HandleScope scope(isolate); |
10950 ASSERT(args.length() == 1); | 10943 ASSERT(args.length() == 1); |
10951 | 10944 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
10952 // Check arguments. | 10945 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
10953 Object* result; | |
10954 { MaybeObject* maybe_result = Runtime_CheckExecutionState( | |
10955 RUNTIME_ARGUMENTS(isolate, args)); | |
10956 if (!maybe_result->ToObject(&result)) return maybe_result; | |
10957 } | |
10958 | 10946 |
10959 // Count all frames which are relevant to debugging stack trace. | 10947 // Count all frames which are relevant to debugging stack trace. |
10960 int n = 0; | 10948 int n = 0; |
10961 StackFrame::Id id = isolate->debug()->break_frame_id(); | 10949 StackFrame::Id id = isolate->debug()->break_frame_id(); |
10962 if (id == StackFrame::NO_ID) { | 10950 if (id == StackFrame::NO_ID) { |
10963 // If there is no JavaScript stack frame count is 0. | 10951 // If there is no JavaScript stack frame count is 0. |
10964 return Smi::FromInt(0); | 10952 return Smi::FromInt(0); |
10965 } | 10953 } |
10966 | 10954 |
10967 for (JavaScriptFrameIterator it(isolate, id); !it.done(); it.Advance()) { | 10955 for (JavaScriptFrameIterator it(isolate, id); !it.done(); it.Advance()) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11084 // 5: Source position | 11072 // 5: Source position |
11085 // 6: Constructor call | 11073 // 6: Constructor call |
11086 // 7: Is at return | 11074 // 7: Is at return |
11087 // 8: Flags | 11075 // 8: Flags |
11088 // Arguments name, value | 11076 // Arguments name, value |
11089 // Locals name, value | 11077 // Locals name, value |
11090 // Return value if any | 11078 // Return value if any |
11091 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) { | 11079 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) { |
11092 HandleScope scope(isolate); | 11080 HandleScope scope(isolate); |
11093 ASSERT(args.length() == 2); | 11081 ASSERT(args.length() == 2); |
| 11082 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
| 11083 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
11094 | 11084 |
11095 // Check arguments. | |
11096 Object* check; | |
11097 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | |
11098 RUNTIME_ARGUMENTS(isolate, args)); | |
11099 if (!maybe_check->ToObject(&check)) return maybe_check; | |
11100 } | |
11101 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); | 11085 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); |
11102 Heap* heap = isolate->heap(); | 11086 Heap* heap = isolate->heap(); |
11103 | 11087 |
11104 // Find the relevant frame with the requested index. | 11088 // Find the relevant frame with the requested index. |
11105 StackFrame::Id id = isolate->debug()->break_frame_id(); | 11089 StackFrame::Id id = isolate->debug()->break_frame_id(); |
11106 if (id == StackFrame::NO_ID) { | 11090 if (id == StackFrame::NO_ID) { |
11107 // If there are no JavaScript stack frames return undefined. | 11091 // If there are no JavaScript stack frames return undefined. |
11108 return heap->undefined_value(); | 11092 return heap->undefined_value(); |
11109 } | 11093 } |
11110 | 11094 |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12114 } | 12098 } |
12115 } | 12099 } |
12116 | 12100 |
12117 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); | 12101 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); |
12118 }; | 12102 }; |
12119 | 12103 |
12120 | 12104 |
12121 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) { | 12105 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) { |
12122 HandleScope scope(isolate); | 12106 HandleScope scope(isolate); |
12123 ASSERT(args.length() == 2); | 12107 ASSERT(args.length() == 2); |
| 12108 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
| 12109 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
12124 | 12110 |
12125 // Check arguments. | |
12126 Object* check; | |
12127 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | |
12128 RUNTIME_ARGUMENTS(isolate, args)); | |
12129 if (!maybe_check->ToObject(&check)) return maybe_check; | |
12130 } | |
12131 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); | 12111 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); |
12132 | 12112 |
12133 // Get the frame where the debugging is performed. | 12113 // Get the frame where the debugging is performed. |
12134 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 12114 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
12135 JavaScriptFrameIterator it(isolate, id); | 12115 JavaScriptFrameIterator it(isolate, id); |
12136 JavaScriptFrame* frame = it.frame(); | 12116 JavaScriptFrame* frame = it.frame(); |
12137 | 12117 |
12138 // Count the visible scopes. | 12118 // Count the visible scopes. |
12139 int n = 0; | 12119 int n = 0; |
12140 for (ScopeIterator it(isolate, frame, 0); | 12120 for (ScopeIterator it(isolate, frame, 0); |
12141 !it.Done(); | 12121 !it.Done(); |
12142 it.Next()) { | 12122 it.Next()) { |
12143 n++; | 12123 n++; |
12144 } | 12124 } |
12145 | 12125 |
12146 return Smi::FromInt(n); | 12126 return Smi::FromInt(n); |
12147 } | 12127 } |
12148 | 12128 |
12149 | 12129 |
12150 // Returns the list of step-in positions (text offset) in a function of the | 12130 // Returns the list of step-in positions (text offset) in a function of the |
12151 // stack frame in a range from the current debug break position to the end | 12131 // stack frame in a range from the current debug break position to the end |
12152 // of the corresponding statement. | 12132 // of the corresponding statement. |
12153 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetStepInPositions) { | 12133 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetStepInPositions) { |
12154 HandleScope scope(isolate); | 12134 HandleScope scope(isolate); |
12155 ASSERT(args.length() == 2); | 12135 ASSERT(args.length() == 2); |
| 12136 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
| 12137 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
12156 | 12138 |
12157 // Check arguments. | |
12158 Object* check; | |
12159 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | |
12160 RUNTIME_ARGUMENTS(isolate, args)); | |
12161 if (!maybe_check->ToObject(&check)) return maybe_check; | |
12162 } | |
12163 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); | 12139 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); |
12164 | 12140 |
12165 // Get the frame where the debugging is performed. | 12141 // Get the frame where the debugging is performed. |
12166 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 12142 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
12167 JavaScriptFrameIterator frame_it(isolate, id); | 12143 JavaScriptFrameIterator frame_it(isolate, id); |
12168 RUNTIME_ASSERT(!frame_it.done()); | 12144 RUNTIME_ASSERT(!frame_it.done()); |
12169 | 12145 |
12170 JavaScriptFrame* frame = frame_it.frame(); | 12146 JavaScriptFrame* frame = frame_it.frame(); |
12171 | 12147 |
12172 Handle<JSFunction> fun = | 12148 Handle<JSFunction> fun = |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12257 // args[1]: number: frame index | 12233 // args[1]: number: frame index |
12258 // args[2]: number: inlined frame index | 12234 // args[2]: number: inlined frame index |
12259 // args[3]: number: scope index | 12235 // args[3]: number: scope index |
12260 // | 12236 // |
12261 // The array returned contains the following information: | 12237 // The array returned contains the following information: |
12262 // 0: Scope type | 12238 // 0: Scope type |
12263 // 1: Scope object | 12239 // 1: Scope object |
12264 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeDetails) { | 12240 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeDetails) { |
12265 HandleScope scope(isolate); | 12241 HandleScope scope(isolate); |
12266 ASSERT(args.length() == 4); | 12242 ASSERT(args.length() == 4); |
| 12243 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
| 12244 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
12267 | 12245 |
12268 // Check arguments. | |
12269 Object* check; | |
12270 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | |
12271 RUNTIME_ARGUMENTS(isolate, args)); | |
12272 if (!maybe_check->ToObject(&check)) return maybe_check; | |
12273 } | |
12274 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); | 12246 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); |
12275 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); | 12247 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); |
12276 CONVERT_NUMBER_CHECKED(int, index, Int32, args[3]); | 12248 CONVERT_NUMBER_CHECKED(int, index, Int32, args[3]); |
12277 | 12249 |
12278 // Get the frame where the debugging is performed. | 12250 // Get the frame where the debugging is performed. |
12279 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 12251 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
12280 JavaScriptFrameIterator frame_it(isolate, id); | 12252 JavaScriptFrameIterator frame_it(isolate, id); |
12281 JavaScriptFrame* frame = frame_it.frame(); | 12253 JavaScriptFrame* frame = frame_it.frame(); |
12282 | 12254 |
12283 // Find the requested scope. | 12255 // Find the requested scope. |
(...skipping 17 matching lines...) Expand all Loading... |
12301 // args[1]: number: frame index | 12273 // args[1]: number: frame index |
12302 // args[2]: number: inlined frame index | 12274 // args[2]: number: inlined frame index |
12303 // args[3]: boolean: ignore nested scopes | 12275 // args[3]: boolean: ignore nested scopes |
12304 // | 12276 // |
12305 // The array returned contains arrays with the following information: | 12277 // The array returned contains arrays with the following information: |
12306 // 0: Scope type | 12278 // 0: Scope type |
12307 // 1: Scope object | 12279 // 1: Scope object |
12308 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetAllScopesDetails) { | 12280 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetAllScopesDetails) { |
12309 HandleScope scope(isolate); | 12281 HandleScope scope(isolate); |
12310 ASSERT(args.length() == 3 || args.length() == 4); | 12282 ASSERT(args.length() == 3 || args.length() == 4); |
| 12283 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
| 12284 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
12311 | 12285 |
12312 // Check arguments. | |
12313 Object* check; | |
12314 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | |
12315 RUNTIME_ARGUMENTS(isolate, args)); | |
12316 if (!maybe_check->ToObject(&check)) return maybe_check; | |
12317 } | |
12318 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); | 12286 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); |
12319 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); | 12287 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); |
12320 | 12288 |
12321 bool ignore_nested_scopes = false; | 12289 bool ignore_nested_scopes = false; |
12322 if (args.length() == 4) { | 12290 if (args.length() == 4) { |
12323 CONVERT_BOOLEAN_ARG_CHECKED(flag, 3); | 12291 CONVERT_BOOLEAN_ARG_CHECKED(flag, 3); |
12324 ignore_nested_scopes = flag; | 12292 ignore_nested_scopes = flag; |
12325 } | 12293 } |
12326 | 12294 |
12327 // Get the frame where the debugging is performed. | 12295 // Get the frame where the debugging is performed. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12414 HandleScope scope(isolate); | 12382 HandleScope scope(isolate); |
12415 ASSERT(args.length() == 6); | 12383 ASSERT(args.length() == 6); |
12416 | 12384 |
12417 // Check arguments. | 12385 // Check arguments. |
12418 CONVERT_NUMBER_CHECKED(int, index, Int32, args[3]); | 12386 CONVERT_NUMBER_CHECKED(int, index, Int32, args[3]); |
12419 CONVERT_ARG_HANDLE_CHECKED(String, variable_name, 4); | 12387 CONVERT_ARG_HANDLE_CHECKED(String, variable_name, 4); |
12420 CONVERT_ARG_HANDLE_CHECKED(Object, new_value, 5); | 12388 CONVERT_ARG_HANDLE_CHECKED(Object, new_value, 5); |
12421 | 12389 |
12422 bool res; | 12390 bool res; |
12423 if (args[0]->IsNumber()) { | 12391 if (args[0]->IsNumber()) { |
12424 Object* check; | 12392 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
12425 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | 12393 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
12426 RUNTIME_ARGUMENTS(isolate, args)); | 12394 |
12427 if (!maybe_check->ToObject(&check)) return maybe_check; | |
12428 } | |
12429 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); | 12395 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); |
12430 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); | 12396 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); |
12431 | 12397 |
12432 // Get the frame where the debugging is performed. | 12398 // Get the frame where the debugging is performed. |
12433 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 12399 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
12434 JavaScriptFrameIterator frame_it(isolate, id); | 12400 JavaScriptFrameIterator frame_it(isolate, id); |
12435 JavaScriptFrame* frame = frame_it.frame(); | 12401 JavaScriptFrame* frame = frame_it.frame(); |
12436 | 12402 |
12437 ScopeIterator it(isolate, frame, inlined_jsframe_index); | 12403 ScopeIterator it(isolate, frame, inlined_jsframe_index); |
12438 res = SetScopeVariableValue(&it, index, variable_name, new_value); | 12404 res = SetScopeVariableValue(&it, index, variable_name, new_value); |
(...skipping 21 matching lines...) Expand all Loading... |
12460 it.DebugPrint(); | 12426 it.DebugPrint(); |
12461 } | 12427 } |
12462 #endif | 12428 #endif |
12463 return isolate->heap()->undefined_value(); | 12429 return isolate->heap()->undefined_value(); |
12464 } | 12430 } |
12465 | 12431 |
12466 | 12432 |
12467 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetThreadCount) { | 12433 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetThreadCount) { |
12468 HandleScope scope(isolate); | 12434 HandleScope scope(isolate); |
12469 ASSERT(args.length() == 1); | 12435 ASSERT(args.length() == 1); |
12470 | 12436 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
12471 // Check arguments. | 12437 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
12472 Object* result; | |
12473 { MaybeObject* maybe_result = Runtime_CheckExecutionState( | |
12474 RUNTIME_ARGUMENTS(isolate, args)); | |
12475 if (!maybe_result->ToObject(&result)) return maybe_result; | |
12476 } | |
12477 | 12438 |
12478 // Count all archived V8 threads. | 12439 // Count all archived V8 threads. |
12479 int n = 0; | 12440 int n = 0; |
12480 for (ThreadState* thread = | 12441 for (ThreadState* thread = |
12481 isolate->thread_manager()->FirstThreadStateInUse(); | 12442 isolate->thread_manager()->FirstThreadStateInUse(); |
12482 thread != NULL; | 12443 thread != NULL; |
12483 thread = thread->Next()) { | 12444 thread = thread->Next()) { |
12484 n++; | 12445 n++; |
12485 } | 12446 } |
12486 | 12447 |
12487 // Total number of threads is current thread and archived threads. | 12448 // Total number of threads is current thread and archived threads. |
12488 return Smi::FromInt(n + 1); | 12449 return Smi::FromInt(n + 1); |
12489 } | 12450 } |
12490 | 12451 |
12491 | 12452 |
12492 static const int kThreadDetailsCurrentThreadIndex = 0; | 12453 static const int kThreadDetailsCurrentThreadIndex = 0; |
12493 static const int kThreadDetailsThreadIdIndex = 1; | 12454 static const int kThreadDetailsThreadIdIndex = 1; |
12494 static const int kThreadDetailsSize = 2; | 12455 static const int kThreadDetailsSize = 2; |
12495 | 12456 |
12496 // Return an array with thread details | 12457 // Return an array with thread details |
12497 // args[0]: number: break id | 12458 // args[0]: number: break id |
12498 // args[1]: number: thread index | 12459 // args[1]: number: thread index |
12499 // | 12460 // |
12500 // The array returned contains the following information: | 12461 // The array returned contains the following information: |
12501 // 0: Is current thread? | 12462 // 0: Is current thread? |
12502 // 1: Thread id | 12463 // 1: Thread id |
12503 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetThreadDetails) { | 12464 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetThreadDetails) { |
12504 HandleScope scope(isolate); | 12465 HandleScope scope(isolate); |
12505 ASSERT(args.length() == 2); | 12466 ASSERT(args.length() == 2); |
| 12467 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
| 12468 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
12506 | 12469 |
12507 // Check arguments. | |
12508 Object* check; | |
12509 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | |
12510 RUNTIME_ARGUMENTS(isolate, args)); | |
12511 if (!maybe_check->ToObject(&check)) return maybe_check; | |
12512 } | |
12513 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); | 12470 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); |
12514 | 12471 |
12515 // Allocate array for result. | 12472 // Allocate array for result. |
12516 Handle<FixedArray> details = | 12473 Handle<FixedArray> details = |
12517 isolate->factory()->NewFixedArray(kThreadDetailsSize); | 12474 isolate->factory()->NewFixedArray(kThreadDetailsSize); |
12518 | 12475 |
12519 // Thread index 0 is current thread. | 12476 // Thread index 0 is current thread. |
12520 if (index == 0) { | 12477 if (index == 0) { |
12521 // Fill the details. | 12478 // Fill the details. |
12522 details->set(kThreadDetailsCurrentThreadIndex, | 12479 details->set(kThreadDetailsCurrentThreadIndex, |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12691 | 12648 |
12692 | 12649 |
12693 // Prepare for stepping | 12650 // Prepare for stepping |
12694 // args[0]: break id for checking execution state | 12651 // args[0]: break id for checking execution state |
12695 // args[1]: step action from the enumeration StepAction | 12652 // args[1]: step action from the enumeration StepAction |
12696 // args[2]: number of times to perform the step, for step out it is the number | 12653 // args[2]: number of times to perform the step, for step out it is the number |
12697 // of frames to step down. | 12654 // of frames to step down. |
12698 RUNTIME_FUNCTION(MaybeObject*, Runtime_PrepareStep) { | 12655 RUNTIME_FUNCTION(MaybeObject*, Runtime_PrepareStep) { |
12699 HandleScope scope(isolate); | 12656 HandleScope scope(isolate); |
12700 ASSERT(args.length() == 4); | 12657 ASSERT(args.length() == 4); |
12701 // Check arguments. | 12658 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
12702 Object* check; | 12659 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
12703 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | 12660 |
12704 RUNTIME_ARGUMENTS(isolate, args)); | |
12705 if (!maybe_check->ToObject(&check)) return maybe_check; | |
12706 } | |
12707 if (!args[1]->IsNumber() || !args[2]->IsNumber()) { | 12661 if (!args[1]->IsNumber() || !args[2]->IsNumber()) { |
12708 return isolate->Throw(isolate->heap()->illegal_argument_string()); | 12662 return isolate->Throw(isolate->heap()->illegal_argument_string()); |
12709 } | 12663 } |
12710 | 12664 |
12711 CONVERT_NUMBER_CHECKED(int, wrapped_frame_id, Int32, args[3]); | 12665 CONVERT_NUMBER_CHECKED(int, wrapped_frame_id, Int32, args[3]); |
12712 | 12666 |
12713 StackFrame::Id frame_id; | 12667 StackFrame::Id frame_id; |
12714 if (wrapped_frame_id == 0) { | 12668 if (wrapped_frame_id == 0) { |
12715 frame_id = StackFrame::NO_ID; | 12669 frame_id = StackFrame::NO_ID; |
12716 } else { | 12670 } else { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12829 // debugging. Things that need special attention are: | 12783 // debugging. Things that need special attention are: |
12830 // - Parameters and stack-allocated locals need to be materialized. Altered | 12784 // - Parameters and stack-allocated locals need to be materialized. Altered |
12831 // values need to be written back to the stack afterwards. | 12785 // values need to be written back to the stack afterwards. |
12832 // - The arguments object needs to materialized. | 12786 // - The arguments object needs to materialized. |
12833 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) { | 12787 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) { |
12834 HandleScope scope(isolate); | 12788 HandleScope scope(isolate); |
12835 | 12789 |
12836 // Check the execution state and decode arguments frame and source to be | 12790 // Check the execution state and decode arguments frame and source to be |
12837 // evaluated. | 12791 // evaluated. |
12838 ASSERT(args.length() == 6); | 12792 ASSERT(args.length() == 6); |
12839 Object* check_result; | 12793 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
12840 { MaybeObject* maybe_result = Runtime_CheckExecutionState( | 12794 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
12841 RUNTIME_ARGUMENTS(isolate, args)); | 12795 |
12842 if (!maybe_result->ToObject(&check_result)) return maybe_result; | |
12843 } | |
12844 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); | 12796 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); |
12845 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); | 12797 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); |
12846 CONVERT_ARG_HANDLE_CHECKED(String, source, 3); | 12798 CONVERT_ARG_HANDLE_CHECKED(String, source, 3); |
12847 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 4); | 12799 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 4); |
12848 CONVERT_ARG_HANDLE_CHECKED(Object, context_extension, 5); | 12800 CONVERT_ARG_HANDLE_CHECKED(Object, context_extension, 5); |
12849 | 12801 |
12850 // Handle the processing of break. | 12802 // Handle the processing of break. |
12851 DisableBreak disable_break_save(isolate, disable_break); | 12803 DisableBreak disable_break_save(isolate, disable_break); |
12852 | 12804 |
12853 // Get the frame where the debugging is performed. | 12805 // Get the frame where the debugging is performed. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12897 return *result; | 12849 return *result; |
12898 } | 12850 } |
12899 | 12851 |
12900 | 12852 |
12901 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) { | 12853 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) { |
12902 HandleScope scope(isolate); | 12854 HandleScope scope(isolate); |
12903 | 12855 |
12904 // Check the execution state and decode arguments frame and source to be | 12856 // Check the execution state and decode arguments frame and source to be |
12905 // evaluated. | 12857 // evaluated. |
12906 ASSERT(args.length() == 4); | 12858 ASSERT(args.length() == 4); |
12907 Object* check_result; | 12859 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
12908 { MaybeObject* maybe_result = Runtime_CheckExecutionState( | 12860 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
12909 RUNTIME_ARGUMENTS(isolate, args)); | 12861 |
12910 if (!maybe_result->ToObject(&check_result)) return maybe_result; | |
12911 } | |
12912 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); | 12862 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); |
12913 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 2); | 12863 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 2); |
12914 CONVERT_ARG_HANDLE_CHECKED(Object, context_extension, 3); | 12864 CONVERT_ARG_HANDLE_CHECKED(Object, context_extension, 3); |
12915 | 12865 |
12916 // Handle the processing of break. | 12866 // Handle the processing of break. |
12917 DisableBreak disable_break_save(isolate, disable_break); | 12867 DisableBreak disable_break_save(isolate, disable_break); |
12918 | 12868 |
12919 // Enter the top context from before the debugger was invoked. | 12869 // Enter the top context from before the debugger was invoked. |
12920 SaveContext save(isolate); | 12870 SaveContext save(isolate); |
12921 SaveContext* top = &save; | 12871 SaveContext* top = &save; |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13486 return *LiveEdit::CompareStrings(s1, s2); | 13436 return *LiveEdit::CompareStrings(s1, s2); |
13487 } | 13437 } |
13488 | 13438 |
13489 | 13439 |
13490 // Restarts a call frame and completely drops all frames above. | 13440 // Restarts a call frame and completely drops all frames above. |
13491 // Returns true if successful. Otherwise returns undefined or an error message. | 13441 // Returns true if successful. Otherwise returns undefined or an error message. |
13492 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditRestartFrame) { | 13442 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditRestartFrame) { |
13493 HandleScope scope(isolate); | 13443 HandleScope scope(isolate); |
13494 CHECK(isolate->debugger()->live_edit_enabled()); | 13444 CHECK(isolate->debugger()->live_edit_enabled()); |
13495 ASSERT(args.length() == 2); | 13445 ASSERT(args.length() == 2); |
| 13446 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
| 13447 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
13496 | 13448 |
13497 // Check arguments. | |
13498 Object* check; | |
13499 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | |
13500 RUNTIME_ARGUMENTS(isolate, args)); | |
13501 if (!maybe_check->ToObject(&check)) return maybe_check; | |
13502 } | |
13503 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); | 13449 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); |
13504 Heap* heap = isolate->heap(); | 13450 Heap* heap = isolate->heap(); |
13505 | 13451 |
13506 // Find the relevant frame with the requested index. | 13452 // Find the relevant frame with the requested index. |
13507 StackFrame::Id id = isolate->debug()->break_frame_id(); | 13453 StackFrame::Id id = isolate->debug()->break_frame_id(); |
13508 if (id == StackFrame::NO_ID) { | 13454 if (id == StackFrame::NO_ID) { |
13509 // If there are no JavaScript stack frames return undefined. | 13455 // If there are no JavaScript stack frames return undefined. |
13510 return heap->undefined_value(); | 13456 return heap->undefined_value(); |
13511 } | 13457 } |
13512 | 13458 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13825 } | 13771 } |
13826 | 13772 |
13827 | 13773 |
13828 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObject) { | 13774 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObject) { |
13829 HandleScope scope(isolate); | 13775 HandleScope scope(isolate); |
13830 | 13776 |
13831 ASSERT(args.length() == 1); | 13777 ASSERT(args.length() == 1); |
13832 | 13778 |
13833 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); | 13779 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
13834 | 13780 |
13835 if (!input->IsJSObject()) return isolate->heap()->ToBoolean(false); | 13781 if (!input->IsJSObject()) return isolate->heap()->false_value(); |
13836 Handle<JSObject> obj = Handle<JSObject>::cast(input); | 13782 Handle<JSObject> obj = Handle<JSObject>::cast(input); |
13837 | 13783 |
13838 Handle<String> marker = isolate->factory()->intl_initialized_marker_string(); | 13784 Handle<String> marker = isolate->factory()->intl_initialized_marker_string(); |
13839 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate); | 13785 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate); |
13840 return isolate->heap()->ToBoolean(!tag->IsTheHole()); | 13786 return isolate->heap()->ToBoolean(!tag->IsTheHole()); |
13841 } | 13787 } |
13842 | 13788 |
13843 | 13789 |
13844 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObjectOfType) { | 13790 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObjectOfType) { |
13845 HandleScope scope(isolate); | 13791 HandleScope scope(isolate); |
13846 | 13792 |
13847 ASSERT(args.length() == 2); | 13793 ASSERT(args.length() == 2); |
13848 | 13794 |
13849 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); | 13795 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
13850 CONVERT_ARG_HANDLE_CHECKED(String, expected_type, 1); | 13796 CONVERT_ARG_HANDLE_CHECKED(String, expected_type, 1); |
13851 | 13797 |
13852 if (!input->IsJSObject()) return isolate->heap()->ToBoolean(false); | 13798 if (!input->IsJSObject()) return isolate->heap()->false_value(); |
13853 Handle<JSObject> obj = Handle<JSObject>::cast(input); | 13799 Handle<JSObject> obj = Handle<JSObject>::cast(input); |
13854 | 13800 |
13855 Handle<String> marker = isolate->factory()->intl_initialized_marker_string(); | 13801 Handle<String> marker = isolate->factory()->intl_initialized_marker_string(); |
13856 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate); | 13802 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate); |
13857 return isolate->heap()->ToBoolean( | 13803 return isolate->heap()->ToBoolean( |
13858 tag->IsString() && String::cast(*tag)->Equals(*expected_type)); | 13804 tag->IsString() && String::cast(*tag)->Equals(*expected_type)); |
13859 } | 13805 } |
13860 | 13806 |
13861 | 13807 |
13862 RUNTIME_FUNCTION(MaybeObject*, Runtime_MarkAsInitializedIntlObjectOfType) { | 13808 RUNTIME_FUNCTION(MaybeObject*, Runtime_MarkAsInitializedIntlObjectOfType) { |
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15108 } | 15054 } |
15109 } | 15055 } |
15110 | 15056 |
15111 | 15057 |
15112 void Runtime::OutOfMemory() { | 15058 void Runtime::OutOfMemory() { |
15113 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); | 15059 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); |
15114 UNREACHABLE(); | 15060 UNREACHABLE(); |
15115 } | 15061 } |
15116 | 15062 |
15117 } } // namespace v8::internal | 15063 } } // namespace v8::internal |
OLD | NEW |