Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/runtime.cc

Issue 240493007: Cleanups in runtime.cc (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6211 matching lines...) Expand 10 before | Expand all | Expand 10 after
6222 // Type", https://bugs.ecmascript.org/show_bug.cgi?id=1584 6222 // Type", https://bugs.ecmascript.org/show_bug.cgi?id=1584
6223 flags |= ALLOW_OCTAL | ALLOW_BINARY; 6223 flags |= ALLOW_OCTAL | ALLOW_BINARY;
6224 } 6224 }
6225 6225
6226 return *isolate->factory()->NewNumber(StringToDouble( 6226 return *isolate->factory()->NewNumber(StringToDouble(
6227 isolate->unicode_cache(), *subject, flags)); 6227 isolate->unicode_cache(), *subject, flags));
6228 } 6228 }
6229 6229
6230 6230
6231 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewString) { 6231 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewString) {
6232 SealHandleScope shs(isolate); 6232 HandleScope scope(isolate);
6233 CONVERT_SMI_ARG_CHECKED(length, 0); 6233 CONVERT_SMI_ARG_CHECKED(length, 0);
6234 CONVERT_BOOLEAN_ARG_CHECKED(is_one_byte, 1); 6234 CONVERT_BOOLEAN_ARG_CHECKED(is_one_byte, 1);
6235 if (length == 0) return isolate->heap()->empty_string(); 6235 if (length == 0) return isolate->heap()->empty_string();
6236 if (is_one_byte) { 6236 if (is_one_byte) {
6237 return isolate->heap()->AllocateRawOneByteString(length); 6237 return *isolate->factory()->NewRawOneByteString(length);
6238 } else { 6238 } else {
6239 return isolate->heap()->AllocateRawTwoByteString(length); 6239 return *isolate->factory()->NewRawTwoByteString(length);
6240 } 6240 }
6241 } 6241 }
6242 6242
6243 6243
6244 RUNTIME_FUNCTION(MaybeObject*, Runtime_TruncateString) { 6244 RUNTIME_FUNCTION(MaybeObject*, Runtime_TruncateString) {
6245 HandleScope scope(isolate); 6245 HandleScope scope(isolate);
6246 CONVERT_ARG_HANDLE_CHECKED(SeqString, string, 0); 6246 CONVERT_ARG_HANDLE_CHECKED(SeqString, string, 0);
6247 CONVERT_SMI_ARG_CHECKED(new_length, 1); 6247 CONVERT_SMI_ARG_CHECKED(new_length, 1);
6248 return *SeqString::Truncate(string, new_length); 6248 return *SeqString::Truncate(string, new_length);
6249 } 6249 }
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
6598 DisallowHeapAllocation no_gc; 6598 DisallowHeapAllocation no_gc;
6599 String::FlatContent flat_content = s->GetFlatContent(); 6599 String::FlatContent flat_content = s->GetFlatContent();
6600 ASSERT(flat_content.IsFlat()); 6600 ASSERT(flat_content.IsFlat());
6601 bool has_changed_character = false; 6601 bool has_changed_character = false;
6602 bool is_ascii = FastAsciiConvert<Converter>( 6602 bool is_ascii = FastAsciiConvert<Converter>(
6603 reinterpret_cast<char*>(result->GetChars()), 6603 reinterpret_cast<char*>(result->GetChars()),
6604 reinterpret_cast<const char*>(flat_content.ToOneByteVector().start()), 6604 reinterpret_cast<const char*>(flat_content.ToOneByteVector().start()),
6605 length, 6605 length,
6606 &has_changed_character); 6606 &has_changed_character);
6607 // If not ASCII, we discard the result and take the 2 byte path. 6607 // If not ASCII, we discard the result and take the 2 byte path.
6608 if (is_ascii) return has_changed_character ? *result : *s; 6608 if (is_ascii) return has_changed_character ? *result : *s;
6609 } 6609 }
6610 6610
6611 Handle<SeqString> result; // Same length as input. 6611 Handle<SeqString> result; // Same length as input.
6612 if (s->IsOneByteRepresentation()) { 6612 if (s->IsOneByteRepresentation()) {
6613 result = isolate->factory()->NewRawOneByteString(length).ToHandleChecked(); 6613 result = isolate->factory()->NewRawOneByteString(length).ToHandleChecked();
6614 } else { 6614 } else {
6615 result = isolate->factory()->NewRawTwoByteString(length).ToHandleChecked(); 6615 result = isolate->factory()->NewRawTwoByteString(length).ToHandleChecked();
6616 } 6616 }
6617 6617
6618 MaybeObject* maybe = ConvertCaseHelper(isolate, *s, *result, length, mapping); 6618 MaybeObject* maybe = ConvertCaseHelper(isolate, *s, *result, length, mapping);
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
8022 return *result; 8022 return *result;
8023 } 8023 }
8024 8024
8025 8025
8026 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewClosureFromStubFailure) { 8026 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewClosureFromStubFailure) {
8027 HandleScope scope(isolate); 8027 HandleScope scope(isolate);
8028 ASSERT(args.length() == 1); 8028 ASSERT(args.length() == 1);
8029 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); 8029 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0);
8030 Handle<Context> context(isolate->context()); 8030 Handle<Context> context(isolate->context());
8031 PretenureFlag pretenure_flag = NOT_TENURED; 8031 PretenureFlag pretenure_flag = NOT_TENURED;
8032 Handle<JSFunction> result = 8032 return *isolate->factory()->NewFunctionFromSharedFunctionInfo(
8033 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, 8033 shared, context, pretenure_flag);
8034 context,
8035 pretenure_flag);
8036 return *result;
8037 } 8034 }
8038 8035
8039 8036
8040 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewClosure) { 8037 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewClosure) {
8041 HandleScope scope(isolate); 8038 HandleScope scope(isolate);
8042 ASSERT(args.length() == 3); 8039 ASSERT(args.length() == 3);
8043 CONVERT_ARG_HANDLE_CHECKED(Context, context, 0); 8040 CONVERT_ARG_HANDLE_CHECKED(Context, context, 0);
8044 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 1); 8041 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 1);
8045 CONVERT_BOOLEAN_ARG_CHECKED(pretenure, 2); 8042 CONVERT_BOOLEAN_ARG_CHECKED(pretenure, 2);
8046 8043
8047 // The caller ensures that we pretenure closures that are assigned 8044 // The caller ensures that we pretenure closures that are assigned
8048 // directly to properties. 8045 // directly to properties.
8049 PretenureFlag pretenure_flag = pretenure ? TENURED : NOT_TENURED; 8046 PretenureFlag pretenure_flag = pretenure ? TENURED : NOT_TENURED;
8050 Handle<JSFunction> result = 8047 return *isolate->factory()->NewFunctionFromSharedFunctionInfo(
8051 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, 8048 shared, context, pretenure_flag);
8052 context,
8053 pretenure_flag);
8054 return *result;
8055 } 8049 }
8056 8050
8057 8051
8058 // Find the arguments of the JavaScript function invocation that called 8052 // Find the arguments of the JavaScript function invocation that called
8059 // into C++ code. Collect these in a newly allocated array of handles (possibly 8053 // into C++ code. Collect these in a newly allocated array of handles (possibly
8060 // prefixed by a number of empty handles). 8054 // prefixed by a number of empty handles).
8061 static SmartArrayPointer<Handle<Object> > GetCallerArguments( 8055 static SmartArrayPointer<Handle<Object> > GetCallerArguments(
8062 Isolate* isolate, 8056 Isolate* isolate,
8063 int prefix_argc, 8057 int prefix_argc,
8064 int* total_argc) { 8058 int* total_argc) {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
8314 HandleScope scope(isolate); 8308 HandleScope scope(isolate);
8315 ASSERT(args.length() == 2); 8309 ASSERT(args.length() == 2);
8316 8310
8317 Handle<Object> constructor = args.at<Object>(1); 8311 Handle<Object> constructor = args.at<Object>(1);
8318 Handle<Object> feedback = args.at<Object>(0); 8312 Handle<Object> feedback = args.at<Object>(0);
8319 Handle<AllocationSite> site; 8313 Handle<AllocationSite> site;
8320 if (feedback->IsAllocationSite()) { 8314 if (feedback->IsAllocationSite()) {
8321 // The feedback can be an AllocationSite or undefined. 8315 // The feedback can be an AllocationSite or undefined.
8322 site = Handle<AllocationSite>::cast(feedback); 8316 site = Handle<AllocationSite>::cast(feedback);
8323 } 8317 }
8324 return Runtime_NewObjectHelper(isolate, 8318 return Runtime_NewObjectHelper(isolate, constructor, site);
8325 constructor,
8326 site);
8327 } 8319 }
8328 8320
8329 8321
8330 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_FinalizeInstanceSize) { 8322 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_FinalizeInstanceSize) {
8331 HandleScope scope(isolate); 8323 HandleScope scope(isolate);
8332 ASSERT(args.length() == 1); 8324 ASSERT(args.length() == 1);
8333 8325
8334 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8326 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8335 function->shared()->CompleteInobjectSlackTracking(); 8327 function->shared()->CompleteInobjectSlackTracking();
8336 8328
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
8528 SealHandleScope shs(isolate); 8520 SealHandleScope shs(isolate);
8529 #if defined(USE_SIMULATOR) 8521 #if defined(USE_SIMULATOR)
8530 return isolate->heap()->true_value(); 8522 return isolate->heap()->true_value();
8531 #else 8523 #else
8532 return isolate->heap()->false_value(); 8524 return isolate->heap()->false_value();
8533 #endif 8525 #endif
8534 } 8526 }
8535 8527
8536 8528
8537 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsConcurrentRecompilationSupported) { 8529 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsConcurrentRecompilationSupported) {
8538 HandleScope scope(isolate); 8530 SealHandleScope shs(isolate);
8539 return isolate->concurrent_recompilation_enabled() 8531 return isolate->heap()->ToBoolean(
8540 ? isolate->heap()->true_value() : isolate->heap()->false_value(); 8532 isolate->concurrent_recompilation_enabled());
8541 } 8533 }
8542 8534
8543 8535
8544 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { 8536 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) {
8545 HandleScope scope(isolate); 8537 HandleScope scope(isolate);
8546 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); 8538 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2);
8547 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8539 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8548 8540
8549 if (!function->IsOptimizable() && 8541 if (!function->IsOptimizable() &&
8550 !function->IsMarkedForConcurrentOptimization() && 8542 !function->IsMarkedForConcurrentOptimization() &&
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
8903 return *result; 8895 return *result;
8904 } 8896 }
8905 8897
8906 8898
8907 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewFunctionContext) { 8899 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewFunctionContext) {
8908 HandleScope scope(isolate); 8900 HandleScope scope(isolate);
8909 ASSERT(args.length() == 1); 8901 ASSERT(args.length() == 1);
8910 8902
8911 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8903 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8912 int length = function->shared()->scope_info()->ContextLength(); 8904 int length = function->shared()->scope_info()->ContextLength();
8913 Handle<Context> context = 8905 return *isolate->factory()->NewFunctionContext(length, function);
8914 isolate->factory()->NewFunctionContext(length, function);
8915 return *context;
8916 } 8906 }
8917 8907
8918 8908
8919 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_PushWithContext) { 8909 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_PushWithContext) {
8920 HandleScope scope(isolate); 8910 HandleScope scope(isolate);
8921 ASSERT(args.length() == 2); 8911 ASSERT(args.length() == 2);
8922 Handle<JSReceiver> extension_object; 8912 Handle<JSReceiver> extension_object;
8923 if (args[0]->IsJSReceiver()) { 8913 if (args[0]->IsJSReceiver()) {
8924 extension_object = args.at<JSReceiver>(0); 8914 extension_object = args.at<JSReceiver>(0);
8925 } else { 8915 } else {
(...skipping 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after
10915 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); 10905 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
10916 RUNTIME_ASSERT(obj->HasIndexedInterceptor()); 10906 RUNTIME_ASSERT(obj->HasIndexedInterceptor());
10917 CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]); 10907 CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]);
10918 Handle<Object> result; 10908 Handle<Object> result;
10919 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 10909 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
10920 isolate, result, JSObject::GetElementWithInterceptor(obj, obj, index)); 10910 isolate, result, JSObject::GetElementWithInterceptor(obj, obj, index));
10921 return *result; 10911 return *result;
10922 } 10912 }
10923 10913
10924 10914
10915 static bool CheckExecutionState(Isolate* isolate, int break_id) {
Jakob Kummerow 2014/04/17 10:45:51 Yes! Enthusiastic +1!
10916 return (isolate->debug()->break_id() != 0 &&
10917 break_id == isolate->debug()->break_id());
10918 }
10919
10920
10925 RUNTIME_FUNCTION(MaybeObject*, Runtime_CheckExecutionState) { 10921 RUNTIME_FUNCTION(MaybeObject*, Runtime_CheckExecutionState) {
10926 SealHandleScope shs(isolate); 10922 SealHandleScope shs(isolate);
10927 ASSERT(args.length() >= 1); 10923 ASSERT(args.length() == 1);
10928 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); 10924 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
10929 // Check that the break id is valid. 10925 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
10930 if (isolate->debug()->break_id() == 0 ||
10931 break_id != isolate->debug()->break_id()) {
10932 return isolate->Throw(
10933 isolate->heap()->illegal_execution_state_string());
Jakob Kummerow 2014/04/17 10:45:51 Turning this into a RUNTIME_ASSERT changes the err
Yang 2014/04/17 10:56:42 Yes. It should never happen. If it then indeed hap
10934 }
10935
10936 return isolate->heap()->true_value(); 10926 return isolate->heap()->true_value();
10937 } 10927 }
10938 10928
10939 10929
10940 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameCount) { 10930 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameCount) {
10941 HandleScope scope(isolate); 10931 HandleScope scope(isolate);
10942 ASSERT(args.length() == 1); 10932 ASSERT(args.length() == 1);
10943 10933 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
10944 // Check arguments. 10934 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
10945 Object* result;
10946 { MaybeObject* maybe_result = Runtime_CheckExecutionState(
10947 RUNTIME_ARGUMENTS(isolate, args));
10948 if (!maybe_result->ToObject(&result)) return maybe_result;
10949 }
10950 10935
10951 // Count all frames which are relevant to debugging stack trace. 10936 // Count all frames which are relevant to debugging stack trace.
10952 int n = 0; 10937 int n = 0;
10953 StackFrame::Id id = isolate->debug()->break_frame_id(); 10938 StackFrame::Id id = isolate->debug()->break_frame_id();
10954 if (id == StackFrame::NO_ID) { 10939 if (id == StackFrame::NO_ID) {
10955 // If there is no JavaScript stack frame count is 0. 10940 // If there is no JavaScript stack frame count is 0.
10956 return Smi::FromInt(0); 10941 return Smi::FromInt(0);
10957 } 10942 }
10958 10943
10959 for (JavaScriptFrameIterator it(isolate, id); !it.done(); it.Advance()) { 10944 for (JavaScriptFrameIterator it(isolate, id); !it.done(); it.Advance()) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
11076 // 5: Source position 11061 // 5: Source position
11077 // 6: Constructor call 11062 // 6: Constructor call
11078 // 7: Is at return 11063 // 7: Is at return
11079 // 8: Flags 11064 // 8: Flags
11080 // Arguments name, value 11065 // Arguments name, value
11081 // Locals name, value 11066 // Locals name, value
11082 // Return value if any 11067 // Return value if any
11083 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) { 11068 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) {
11084 HandleScope scope(isolate); 11069 HandleScope scope(isolate);
11085 ASSERT(args.length() == 2); 11070 ASSERT(args.length() == 2);
11071 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
11072 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
11086 11073
11087 // Check arguments.
11088 Object* check;
11089 { MaybeObject* maybe_check = Runtime_CheckExecutionState(
11090 RUNTIME_ARGUMENTS(isolate, args));
11091 if (!maybe_check->ToObject(&check)) return maybe_check;
11092 }
11093 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); 11074 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
11094 Heap* heap = isolate->heap(); 11075 Heap* heap = isolate->heap();
11095 11076
11096 // Find the relevant frame with the requested index. 11077 // Find the relevant frame with the requested index.
11097 StackFrame::Id id = isolate->debug()->break_frame_id(); 11078 StackFrame::Id id = isolate->debug()->break_frame_id();
11098 if (id == StackFrame::NO_ID) { 11079 if (id == StackFrame::NO_ID) {
11099 // If there are no JavaScript stack frames return undefined. 11080 // If there are no JavaScript stack frames return undefined.
11100 return heap->undefined_value(); 11081 return heap->undefined_value();
11101 } 11082 }
11102 11083
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
12106 } 12087 }
12107 } 12088 }
12108 12089
12109 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); 12090 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator);
12110 }; 12091 };
12111 12092
12112 12093
12113 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) { 12094 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) {
12114 HandleScope scope(isolate); 12095 HandleScope scope(isolate);
12115 ASSERT(args.length() == 2); 12096 ASSERT(args.length() == 2);
12097 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
12098 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
12116 12099
12117 // Check arguments.
12118 Object* check;
12119 { MaybeObject* maybe_check = Runtime_CheckExecutionState(
12120 RUNTIME_ARGUMENTS(isolate, args));
12121 if (!maybe_check->ToObject(&check)) return maybe_check;
12122 }
12123 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); 12100 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
12124 12101
12125 // Get the frame where the debugging is performed. 12102 // Get the frame where the debugging is performed.
12126 StackFrame::Id id = UnwrapFrameId(wrapped_id); 12103 StackFrame::Id id = UnwrapFrameId(wrapped_id);
12127 JavaScriptFrameIterator it(isolate, id); 12104 JavaScriptFrameIterator it(isolate, id);
12128 JavaScriptFrame* frame = it.frame(); 12105 JavaScriptFrame* frame = it.frame();
12129 12106
12130 // Count the visible scopes. 12107 // Count the visible scopes.
12131 int n = 0; 12108 int n = 0;
12132 for (ScopeIterator it(isolate, frame, 0); 12109 for (ScopeIterator it(isolate, frame, 0);
12133 !it.Done(); 12110 !it.Done();
12134 it.Next()) { 12111 it.Next()) {
12135 n++; 12112 n++;
12136 } 12113 }
12137 12114
12138 return Smi::FromInt(n); 12115 return Smi::FromInt(n);
12139 } 12116 }
12140 12117
12141 12118
12142 // Returns the list of step-in positions (text offset) in a function of the 12119 // Returns the list of step-in positions (text offset) in a function of the
12143 // stack frame in a range from the current debug break position to the end 12120 // stack frame in a range from the current debug break position to the end
12144 // of the corresponding statement. 12121 // of the corresponding statement.
12145 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetStepInPositions) { 12122 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetStepInPositions) {
12146 HandleScope scope(isolate); 12123 HandleScope scope(isolate);
12147 ASSERT(args.length() == 2); 12124 ASSERT(args.length() == 2);
12125 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
12126 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
12148 12127
12149 // Check arguments.
12150 Object* check;
12151 { MaybeObject* maybe_check = Runtime_CheckExecutionState(
12152 RUNTIME_ARGUMENTS(isolate, args));
12153 if (!maybe_check->ToObject(&check)) return maybe_check;
12154 }
12155 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); 12128 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
12156 12129
12157 // Get the frame where the debugging is performed. 12130 // Get the frame where the debugging is performed.
12158 StackFrame::Id id = UnwrapFrameId(wrapped_id); 12131 StackFrame::Id id = UnwrapFrameId(wrapped_id);
12159 JavaScriptFrameIterator frame_it(isolate, id); 12132 JavaScriptFrameIterator frame_it(isolate, id);
12160 RUNTIME_ASSERT(!frame_it.done()); 12133 RUNTIME_ASSERT(!frame_it.done());
12161 12134
12162 JavaScriptFrame* frame = frame_it.frame(); 12135 JavaScriptFrame* frame = frame_it.frame();
12163 12136
12164 Handle<JSFunction> fun = 12137 Handle<JSFunction> fun =
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
12249 // args[1]: number: frame index 12222 // args[1]: number: frame index
12250 // args[2]: number: inlined frame index 12223 // args[2]: number: inlined frame index
12251 // args[3]: number: scope index 12224 // args[3]: number: scope index
12252 // 12225 //
12253 // The array returned contains the following information: 12226 // The array returned contains the following information:
12254 // 0: Scope type 12227 // 0: Scope type
12255 // 1: Scope object 12228 // 1: Scope object
12256 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeDetails) { 12229 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeDetails) {
12257 HandleScope scope(isolate); 12230 HandleScope scope(isolate);
12258 ASSERT(args.length() == 4); 12231 ASSERT(args.length() == 4);
12232 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
12233 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
12259 12234
12260 // Check arguments.
12261 Object* check;
12262 { MaybeObject* maybe_check = Runtime_CheckExecutionState(
12263 RUNTIME_ARGUMENTS(isolate, args));
12264 if (!maybe_check->ToObject(&check)) return maybe_check;
12265 }
12266 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); 12235 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
12267 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); 12236 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
12268 CONVERT_NUMBER_CHECKED(int, index, Int32, args[3]); 12237 CONVERT_NUMBER_CHECKED(int, index, Int32, args[3]);
12269 12238
12270 // Get the frame where the debugging is performed. 12239 // Get the frame where the debugging is performed.
12271 StackFrame::Id id = UnwrapFrameId(wrapped_id); 12240 StackFrame::Id id = UnwrapFrameId(wrapped_id);
12272 JavaScriptFrameIterator frame_it(isolate, id); 12241 JavaScriptFrameIterator frame_it(isolate, id);
12273 JavaScriptFrame* frame = frame_it.frame(); 12242 JavaScriptFrame* frame = frame_it.frame();
12274 12243
12275 // Find the requested scope. 12244 // Find the requested scope.
(...skipping 17 matching lines...) Expand all
12293 // args[1]: number: frame index 12262 // args[1]: number: frame index
12294 // args[2]: number: inlined frame index 12263 // args[2]: number: inlined frame index
12295 // args[3]: boolean: ignore nested scopes 12264 // args[3]: boolean: ignore nested scopes
12296 // 12265 //
12297 // The array returned contains arrays with the following information: 12266 // The array returned contains arrays with the following information:
12298 // 0: Scope type 12267 // 0: Scope type
12299 // 1: Scope object 12268 // 1: Scope object
12300 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetAllScopesDetails) { 12269 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetAllScopesDetails) {
12301 HandleScope scope(isolate); 12270 HandleScope scope(isolate);
12302 ASSERT(args.length() == 3 || args.length() == 4); 12271 ASSERT(args.length() == 3 || args.length() == 4);
12272 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
12273 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
12303 12274
12304 // Check arguments.
12305 Object* check;
12306 { MaybeObject* maybe_check = Runtime_CheckExecutionState(
12307 RUNTIME_ARGUMENTS(isolate, args));
12308 if (!maybe_check->ToObject(&check)) return maybe_check;
12309 }
12310 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); 12275 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
12311 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); 12276 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
12312 12277
12313 bool ignore_nested_scopes = false; 12278 bool ignore_nested_scopes = false;
12314 if (args.length() == 4) { 12279 if (args.length() == 4) {
12315 CONVERT_BOOLEAN_ARG_CHECKED(flag, 3); 12280 CONVERT_BOOLEAN_ARG_CHECKED(flag, 3);
12316 ignore_nested_scopes = flag; 12281 ignore_nested_scopes = flag;
12317 } 12282 }
12318 12283
12319 // Get the frame where the debugging is performed. 12284 // Get the frame where the debugging is performed.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
12407 HandleScope scope(isolate); 12372 HandleScope scope(isolate);
12408 ASSERT(args.length() == 6); 12373 ASSERT(args.length() == 6);
12409 12374
12410 // Check arguments. 12375 // Check arguments.
12411 CONVERT_NUMBER_CHECKED(int, index, Int32, args[3]); 12376 CONVERT_NUMBER_CHECKED(int, index, Int32, args[3]);
12412 CONVERT_ARG_HANDLE_CHECKED(String, variable_name, 4); 12377 CONVERT_ARG_HANDLE_CHECKED(String, variable_name, 4);
12413 Handle<Object> new_value = args.at<Object>(5); 12378 Handle<Object> new_value = args.at<Object>(5);
12414 12379
12415 bool res; 12380 bool res;
12416 if (args[0]->IsNumber()) { 12381 if (args[0]->IsNumber()) {
12417 Object* check; 12382 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
12418 { MaybeObject* maybe_check = Runtime_CheckExecutionState( 12383 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
12419 RUNTIME_ARGUMENTS(isolate, args)); 12384
12420 if (!maybe_check->ToObject(&check)) return maybe_check;
12421 }
12422 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); 12385 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
12423 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); 12386 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
12424 12387
12425 // Get the frame where the debugging is performed. 12388 // Get the frame where the debugging is performed.
12426 StackFrame::Id id = UnwrapFrameId(wrapped_id); 12389 StackFrame::Id id = UnwrapFrameId(wrapped_id);
12427 JavaScriptFrameIterator frame_it(isolate, id); 12390 JavaScriptFrameIterator frame_it(isolate, id);
12428 JavaScriptFrame* frame = frame_it.frame(); 12391 JavaScriptFrame* frame = frame_it.frame();
12429 12392
12430 ScopeIterator it(isolate, frame, inlined_jsframe_index); 12393 ScopeIterator it(isolate, frame, inlined_jsframe_index);
12431 res = SetScopeVariableValue(&it, index, variable_name, new_value); 12394 res = SetScopeVariableValue(&it, index, variable_name, new_value);
(...skipping 21 matching lines...) Expand all
12453 it.DebugPrint(); 12416 it.DebugPrint();
12454 } 12417 }
12455 #endif 12418 #endif
12456 return isolate->heap()->undefined_value(); 12419 return isolate->heap()->undefined_value();
12457 } 12420 }
12458 12421
12459 12422
12460 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetThreadCount) { 12423 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetThreadCount) {
12461 HandleScope scope(isolate); 12424 HandleScope scope(isolate);
12462 ASSERT(args.length() == 1); 12425 ASSERT(args.length() == 1);
12463 12426 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
12464 // Check arguments. 12427 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
12465 Object* result;
12466 { MaybeObject* maybe_result = Runtime_CheckExecutionState(
12467 RUNTIME_ARGUMENTS(isolate, args));
12468 if (!maybe_result->ToObject(&result)) return maybe_result;
12469 }
12470 12428
12471 // Count all archived V8 threads. 12429 // Count all archived V8 threads.
12472 int n = 0; 12430 int n = 0;
12473 for (ThreadState* thread = 12431 for (ThreadState* thread =
12474 isolate->thread_manager()->FirstThreadStateInUse(); 12432 isolate->thread_manager()->FirstThreadStateInUse();
12475 thread != NULL; 12433 thread != NULL;
12476 thread = thread->Next()) { 12434 thread = thread->Next()) {
12477 n++; 12435 n++;
12478 } 12436 }
12479 12437
12480 // Total number of threads is current thread and archived threads. 12438 // Total number of threads is current thread and archived threads.
12481 return Smi::FromInt(n + 1); 12439 return Smi::FromInt(n + 1);
12482 } 12440 }
12483 12441
12484 12442
12485 static const int kThreadDetailsCurrentThreadIndex = 0; 12443 static const int kThreadDetailsCurrentThreadIndex = 0;
12486 static const int kThreadDetailsThreadIdIndex = 1; 12444 static const int kThreadDetailsThreadIdIndex = 1;
12487 static const int kThreadDetailsSize = 2; 12445 static const int kThreadDetailsSize = 2;
12488 12446
12489 // Return an array with thread details 12447 // Return an array with thread details
12490 // args[0]: number: break id 12448 // args[0]: number: break id
12491 // args[1]: number: thread index 12449 // args[1]: number: thread index
12492 // 12450 //
12493 // The array returned contains the following information: 12451 // The array returned contains the following information:
12494 // 0: Is current thread? 12452 // 0: Is current thread?
12495 // 1: Thread id 12453 // 1: Thread id
12496 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetThreadDetails) { 12454 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetThreadDetails) {
12497 HandleScope scope(isolate); 12455 HandleScope scope(isolate);
12498 ASSERT(args.length() == 2); 12456 ASSERT(args.length() == 2);
12457 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
12458 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
12499 12459
12500 // Check arguments.
12501 Object* check;
12502 { MaybeObject* maybe_check = Runtime_CheckExecutionState(
12503 RUNTIME_ARGUMENTS(isolate, args));
12504 if (!maybe_check->ToObject(&check)) return maybe_check;
12505 }
12506 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); 12460 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
12507 12461
12508 // Allocate array for result. 12462 // Allocate array for result.
12509 Handle<FixedArray> details = 12463 Handle<FixedArray> details =
12510 isolate->factory()->NewFixedArray(kThreadDetailsSize); 12464 isolate->factory()->NewFixedArray(kThreadDetailsSize);
12511 12465
12512 // Thread index 0 is current thread. 12466 // Thread index 0 is current thread.
12513 if (index == 0) { 12467 if (index == 0) {
12514 // Fill the details. 12468 // Fill the details.
12515 details->set(kThreadDetailsCurrentThreadIndex, 12469 details->set(kThreadDetailsCurrentThreadIndex,
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
12686 12640
12687 12641
12688 // Prepare for stepping 12642 // Prepare for stepping
12689 // args[0]: break id for checking execution state 12643 // args[0]: break id for checking execution state
12690 // args[1]: step action from the enumeration StepAction 12644 // args[1]: step action from the enumeration StepAction
12691 // args[2]: number of times to perform the step, for step out it is the number 12645 // args[2]: number of times to perform the step, for step out it is the number
12692 // of frames to step down. 12646 // of frames to step down.
12693 RUNTIME_FUNCTION(MaybeObject*, Runtime_PrepareStep) { 12647 RUNTIME_FUNCTION(MaybeObject*, Runtime_PrepareStep) {
12694 HandleScope scope(isolate); 12648 HandleScope scope(isolate);
12695 ASSERT(args.length() == 4); 12649 ASSERT(args.length() == 4);
12696 // Check arguments. 12650 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
12697 Object* check; 12651 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
12698 { MaybeObject* maybe_check = Runtime_CheckExecutionState( 12652
12699 RUNTIME_ARGUMENTS(isolate, args));
12700 if (!maybe_check->ToObject(&check)) return maybe_check;
12701 }
12702 if (!args[1]->IsNumber() || !args[2]->IsNumber()) { 12653 if (!args[1]->IsNumber() || !args[2]->IsNumber()) {
12703 return isolate->Throw(isolate->heap()->illegal_argument_string()); 12654 return isolate->Throw(isolate->heap()->illegal_argument_string());
12704 } 12655 }
12705 12656
12706 CONVERT_NUMBER_CHECKED(int, wrapped_frame_id, Int32, args[3]); 12657 CONVERT_NUMBER_CHECKED(int, wrapped_frame_id, Int32, args[3]);
12707 12658
12708 StackFrame::Id frame_id; 12659 StackFrame::Id frame_id;
12709 if (wrapped_frame_id == 0) { 12660 if (wrapped_frame_id == 0) {
12710 frame_id = StackFrame::NO_ID; 12661 frame_id = StackFrame::NO_ID;
12711 } else { 12662 } else {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
12824 // debugging. Things that need special attention are: 12775 // debugging. Things that need special attention are:
12825 // - Parameters and stack-allocated locals need to be materialized. Altered 12776 // - Parameters and stack-allocated locals need to be materialized. Altered
12826 // values need to be written back to the stack afterwards. 12777 // values need to be written back to the stack afterwards.
12827 // - The arguments object needs to materialized. 12778 // - The arguments object needs to materialized.
12828 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) { 12779 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
12829 HandleScope scope(isolate); 12780 HandleScope scope(isolate);
12830 12781
12831 // Check the execution state and decode arguments frame and source to be 12782 // Check the execution state and decode arguments frame and source to be
12832 // evaluated. 12783 // evaluated.
12833 ASSERT(args.length() == 6); 12784 ASSERT(args.length() == 6);
12834 Object* check_result; 12785 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
12835 { MaybeObject* maybe_result = Runtime_CheckExecutionState( 12786 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
12836 RUNTIME_ARGUMENTS(isolate, args)); 12787
12837 if (!maybe_result->ToObject(&check_result)) return maybe_result;
12838 }
12839 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); 12788 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
12840 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); 12789 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
12841 CONVERT_ARG_HANDLE_CHECKED(String, source, 3); 12790 CONVERT_ARG_HANDLE_CHECKED(String, source, 3);
12842 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 4); 12791 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 4);
12843 Handle<Object> context_extension(args[5], isolate); 12792 Handle<Object> context_extension(args[5], isolate);
12844 12793
12845 // Handle the processing of break. 12794 // Handle the processing of break.
12846 DisableBreak disable_break_save(isolate, disable_break); 12795 DisableBreak disable_break_save(isolate, disable_break);
12847 12796
12848 // Get the frame where the debugging is performed. 12797 // Get the frame where the debugging is performed.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
12892 return *result; 12841 return *result;
12893 } 12842 }
12894 12843
12895 12844
12896 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) { 12845 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) {
12897 HandleScope scope(isolate); 12846 HandleScope scope(isolate);
12898 12847
12899 // Check the execution state and decode arguments frame and source to be 12848 // Check the execution state and decode arguments frame and source to be
12900 // evaluated. 12849 // evaluated.
12901 ASSERT(args.length() == 4); 12850 ASSERT(args.length() == 4);
12902 Object* check_result; 12851 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
12903 { MaybeObject* maybe_result = Runtime_CheckExecutionState( 12852 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
12904 RUNTIME_ARGUMENTS(isolate, args)); 12853
12905 if (!maybe_result->ToObject(&check_result)) return maybe_result;
12906 }
12907 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); 12854 CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
12908 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 2); 12855 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 2);
12909 Handle<Object> context_extension(args[3], isolate); 12856 Handle<Object> context_extension(args[3], isolate);
12910 12857
12911 // Handle the processing of break. 12858 // Handle the processing of break.
12912 DisableBreak disable_break_save(isolate, disable_break); 12859 DisableBreak disable_break_save(isolate, disable_break);
12913 12860
12914 // Enter the top context from before the debugger was invoked. 12861 // Enter the top context from before the debugger was invoked.
12915 SaveContext save(isolate); 12862 SaveContext save(isolate);
12916 SaveContext* top = &save; 12863 SaveContext* top = &save;
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
13481 return *LiveEdit::CompareStrings(s1, s2); 13428 return *LiveEdit::CompareStrings(s1, s2);
13482 } 13429 }
13483 13430
13484 13431
13485 // Restarts a call frame and completely drops all frames above. 13432 // Restarts a call frame and completely drops all frames above.
13486 // Returns true if successful. Otherwise returns undefined or an error message. 13433 // Returns true if successful. Otherwise returns undefined or an error message.
13487 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditRestartFrame) { 13434 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditRestartFrame) {
13488 HandleScope scope(isolate); 13435 HandleScope scope(isolate);
13489 CHECK(isolate->debugger()->live_edit_enabled()); 13436 CHECK(isolate->debugger()->live_edit_enabled());
13490 ASSERT(args.length() == 2); 13437 ASSERT(args.length() == 2);
13438 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
13439 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
13491 13440
13492 // Check arguments.
13493 Object* check;
13494 { MaybeObject* maybe_check = Runtime_CheckExecutionState(
13495 RUNTIME_ARGUMENTS(isolate, args));
13496 if (!maybe_check->ToObject(&check)) return maybe_check;
13497 }
13498 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); 13441 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
13499 Heap* heap = isolate->heap(); 13442 Heap* heap = isolate->heap();
13500 13443
13501 // Find the relevant frame with the requested index. 13444 // Find the relevant frame with the requested index.
13502 StackFrame::Id id = isolate->debug()->break_frame_id(); 13445 StackFrame::Id id = isolate->debug()->break_frame_id();
13503 if (id == StackFrame::NO_ID) { 13446 if (id == StackFrame::NO_ID) {
13504 // If there are no JavaScript stack frames return undefined. 13447 // If there are no JavaScript stack frames return undefined.
13505 return heap->undefined_value(); 13448 return heap->undefined_value();
13506 } 13449 }
13507 13450
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
13817 } 13760 }
13818 13761
13819 13762
13820 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObject) { 13763 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObject) {
13821 HandleScope scope(isolate); 13764 HandleScope scope(isolate);
13822 13765
13823 ASSERT(args.length() == 1); 13766 ASSERT(args.length() == 1);
13824 13767
13825 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); 13768 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
13826 13769
13827 if (!input->IsJSObject()) return isolate->heap()->ToBoolean(false); 13770 if (!input->IsJSObject()) return isolate->heap()->false_value();
13828 Handle<JSObject> obj = Handle<JSObject>::cast(input); 13771 Handle<JSObject> obj = Handle<JSObject>::cast(input);
13829 13772
13830 Handle<String> marker = isolate->factory()->intl_initialized_marker_string(); 13773 Handle<String> marker = isolate->factory()->intl_initialized_marker_string();
13831 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate); 13774 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate);
13832 return isolate->heap()->ToBoolean(!tag->IsTheHole()); 13775 return isolate->heap()->ToBoolean(!tag->IsTheHole());
13833 } 13776 }
13834 13777
13835 13778
13836 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObjectOfType) { 13779 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObjectOfType) {
13837 HandleScope scope(isolate); 13780 HandleScope scope(isolate);
13838 13781
13839 ASSERT(args.length() == 2); 13782 ASSERT(args.length() == 2);
13840 13783
13841 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); 13784 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
13842 CONVERT_ARG_HANDLE_CHECKED(String, expected_type, 1); 13785 CONVERT_ARG_HANDLE_CHECKED(String, expected_type, 1);
13843 13786
13844 if (!input->IsJSObject()) return isolate->heap()->ToBoolean(false); 13787 if (!input->IsJSObject()) return isolate->heap()->false_value();
13845 Handle<JSObject> obj = Handle<JSObject>::cast(input); 13788 Handle<JSObject> obj = Handle<JSObject>::cast(input);
13846 13789
13847 Handle<String> marker = isolate->factory()->intl_initialized_marker_string(); 13790 Handle<String> marker = isolate->factory()->intl_initialized_marker_string();
13848 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate); 13791 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate);
13849 return isolate->heap()->ToBoolean( 13792 return isolate->heap()->ToBoolean(
13850 tag->IsString() && String::cast(*tag)->Equals(*expected_type)); 13793 tag->IsString() && String::cast(*tag)->Equals(*expected_type));
13851 } 13794 }
13852 13795
13853 13796
13854 RUNTIME_FUNCTION(MaybeObject*, Runtime_MarkAsInitializedIntlObjectOfType) { 13797 RUNTIME_FUNCTION(MaybeObject*, Runtime_MarkAsInitializedIntlObjectOfType) {
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
15097 } 15040 }
15098 } 15041 }
15099 15042
15100 15043
15101 void Runtime::OutOfMemory() { 15044 void Runtime::OutOfMemory() {
15102 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15045 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15103 UNREACHABLE(); 15046 UNREACHABLE();
15104 } 15047 }
15105 15048
15106 } } // namespace v8::internal 15049 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698