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 13091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13102 RUNTIME_FUNCTION(MaybeObject*, Runtime_MarkOneShotGetter) { | 13102 RUNTIME_FUNCTION(MaybeObject*, Runtime_MarkOneShotGetter) { |
| 13103 ASSERT_EQ(args.length(), 1); | 13103 ASSERT_EQ(args.length(), 1); |
| 13104 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); | 13104 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); |
| 13105 HandleScope scope(isolate); | 13105 HandleScope scope(isolate); |
| 13106 Handle<String> key = isolate->factory()->hidden_stack_trace_symbol(); | 13106 Handle<String> key = isolate->factory()->hidden_stack_trace_symbol(); |
| 13107 JSObject::SetHiddenProperty(fun, key, key); | 13107 JSObject::SetHiddenProperty(fun, key, key); |
| 13108 return *fun; | 13108 return *fun; |
| 13109 } | 13109 } |
| 13110 | 13110 |
| 13111 | 13111 |
| 13112 // Retrieve the raw stack trace collected on stack overflow and delete | 13112 // Retrieve the stack trace. This could be the raw stack trace collected |
| 13113 // it since it is used only once to avoid keeping it alive. | 13113 // on stack overflow or the already formatted stack trace string. |
| 13114 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOverflowedRawStackTrace) { | 13114 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOverflowedStackTrace) { |
| 13115 ASSERT_EQ(args.length(), 1); | 13115 ASSERT_EQ(args.length(), 1); |
|
Michael Starzinger
2012/12/11 14:52:35
This method should either have a NoHandleAllocatio
| |
| 13116 CONVERT_ARG_CHECKED(JSObject, error_object, 0); | 13116 CONVERT_ARG_CHECKED(JSObject, error_object, 0); |
| 13117 String* key = isolate->heap()->hidden_stack_trace_symbol(); | 13117 String* key = isolate->heap()->hidden_stack_trace_symbol(); |
| 13118 Object* result = error_object->GetHiddenProperty(key); | 13118 Object* result = error_object->GetHiddenProperty(key); |
| 13119 RUNTIME_ASSERT(result->IsJSArray() || result->IsUndefined()); | 13119 RUNTIME_ASSERT(result->IsJSArray() || |
| 13120 error_object->DeleteHiddenProperty(key); | 13120 result->IsString() || |
| 13121 result->IsUndefined()); | |
| 13121 return result; | 13122 return result; |
| 13122 } | 13123 } |
| 13123 | 13124 |
| 13124 | 13125 |
| 13126 // Set or clear the stack trace attached to an stack overflow error object. | |
| 13127 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetOverflowedStackTrace) { | |
| 13128 ASSERT_EQ(args.length(), 2); | |
|
Michael Starzinger
2012/12/11 14:52:35
Likewise.
| |
| 13129 CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0); | |
| 13130 CONVERT_ARG_HANDLE_CHECKED(HeapObject, value, 1); | |
| 13131 Handle<String> key = isolate->factory()->hidden_stack_trace_symbol(); | |
| 13132 if (value->IsUndefined()) { | |
| 13133 error_object->DeleteHiddenProperty(*key); | |
| 13134 } else { | |
| 13135 RUNTIME_ASSERT(value->IsString()); | |
| 13136 JSObject::SetHiddenProperty(error_object, key, value); | |
| 13137 } | |
| 13138 return *error_object; | |
| 13139 } | |
| 13140 | |
| 13141 | |
| 13125 // Returns V8 version as a string. | 13142 // Returns V8 version as a string. |
| 13126 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetV8Version) { | 13143 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetV8Version) { |
| 13127 ASSERT_EQ(args.length(), 0); | 13144 ASSERT_EQ(args.length(), 0); |
| 13128 | 13145 |
| 13129 NoHandleAllocation ha; | 13146 NoHandleAllocation ha; |
| 13130 | 13147 |
| 13131 const char* version_string = v8::V8::GetVersion(); | 13148 const char* version_string = v8::V8::GetVersion(); |
| 13132 | 13149 |
| 13133 return isolate->heap()->AllocateStringFromOneByte(CStrVector(version_string), | 13150 return isolate->heap()->AllocateStringFromOneByte(CStrVector(version_string), |
| 13134 NOT_TENURED); | 13151 NOT_TENURED); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13515 // Handle last resort GC and make sure to allow future allocations | 13532 // Handle last resort GC and make sure to allow future allocations |
| 13516 // to grow the heap without causing GCs (if possible). | 13533 // to grow the heap without causing GCs (if possible). |
| 13517 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13534 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13518 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13535 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13519 "Runtime::PerformGC"); | 13536 "Runtime::PerformGC"); |
| 13520 } | 13537 } |
| 13521 } | 13538 } |
| 13522 | 13539 |
| 13523 | 13540 |
| 13524 } } // namespace v8::internal | 13541 } } // namespace v8::internal |
| OLD | NEW |