OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 12135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12146 return isolate->heap()->undefined_value(); | 12146 return isolate->heap()->undefined_value(); |
12147 } | 12147 } |
12148 | 12148 |
12149 | 12149 |
12150 RUNTIME_FUNCTION(MaybeObject*, Runtime_ProfilerPause) { | 12150 RUNTIME_FUNCTION(MaybeObject*, Runtime_ProfilerPause) { |
12151 NoHandleAllocation ha; | 12151 NoHandleAllocation ha; |
12152 v8::V8::PauseProfiler(); | 12152 v8::V8::PauseProfiler(); |
12153 return isolate->heap()->undefined_value(); | 12153 return isolate->heap()->undefined_value(); |
12154 } | 12154 } |
12155 | 12155 |
12156 | |
12157 static v8::Handle<v8::Value> EmptyMethod(const v8::Arguments& args) { | |
12158 return v8::Handle<v8::Value>(); | |
12159 } | |
12160 | |
Søren Thygesen Gjesse
2011/07/07 11:59:53
I don't think that specialized testing functions l
mnaganov (inactive)
2011/07/07 20:19:57
Those tests were cctests initially. Two reasons I'
| |
12161 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateClassWithCallback) { | |
12162 ASSERT(args.length() == 2); | |
12163 CONVERT_ARG_CHECKED(String, className, 0); | |
12164 CONVERT_ARG_CHECKED(String, methodName, 1); | |
12165 v8::HandleScope scope; | |
12166 v8::Handle<v8::FunctionTemplate> obj = v8::FunctionTemplate::New(); | |
12167 obj->SetClassName(v8::Handle<v8::String>(ToApi<v8::String>(className))); | |
12168 v8::Handle<v8::ObjectTemplate> proto(obj->PrototypeTemplate()); | |
12169 v8::Local<v8::Signature> signature = v8::Signature::New(obj); | |
12170 proto->Set( | |
12171 v8::Handle<v8::String>(ToApi<v8::String>(methodName)), | |
12172 v8::FunctionTemplate::New(EmptyMethod, | |
12173 v8::Handle<v8::Value>(), | |
12174 signature), | |
12175 static_cast<v8::PropertyAttribute>(v8::DontDelete)); | |
12176 return *Utils::OpenHandle(*obj->GetFunction()); | |
12177 } | |
12178 | |
12179 | |
12180 static v8::Handle<v8::Value> EmptyGetter(v8::Local<v8::String> property, | |
12181 const v8::AccessorInfo& info) { | |
12182 return v8::Handle<v8::Value>(); | |
12183 } | |
12184 | |
12185 static void EmptySetter(v8::Local<v8::String> property, | |
12186 v8::Local<v8::Value> value, | |
12187 const v8::AccessorInfo& info) { | |
12188 } | |
12189 | |
12190 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateClassWithGetterAndSetter) { | |
12191 ASSERT(args.length() == 3); | |
12192 CONVERT_ARG_CHECKED(String, className, 0); | |
12193 CONVERT_ARG_CHECKED(String, property1Name, 1); | |
12194 CONVERT_ARG_CHECKED(String, property2Name, 2); | |
12195 v8::HandleScope scope; | |
12196 v8::Handle<v8::FunctionTemplate> obj = v8::FunctionTemplate::New(); | |
12197 obj->SetClassName(v8::Handle<v8::String>(ToApi<v8::String>(className))); | |
12198 v8::Handle<v8::ObjectTemplate> inst = obj->InstanceTemplate(); | |
12199 inst->SetAccessor(v8::Handle<v8::String>(ToApi<v8::String>(property1Name)), | |
12200 EmptyGetter, | |
12201 EmptySetter); | |
12202 inst->SetAccessor(v8::Handle<v8::String>(ToApi<v8::String>(property2Name)), | |
12203 EmptyGetter); | |
12204 return *Utils::OpenHandle(*obj->GetFunction()); | |
12205 } | |
12206 | |
12207 RUNTIME_FUNCTION(MaybeObject*, Runtime_LogCompiledFunctions) { | |
12208 bool old_log_code = FLAG_log_code; | |
12209 FLAG_log_code = true; | |
12210 isolate->logger()->LogCompiledFunctions(); | |
12211 isolate->logger()->LogAccessorCallbacks(); | |
12212 FLAG_log_code = old_log_code; | |
12213 return isolate->heap()->undefined_value(); | |
12214 } | |
12215 | |
12216 // Doesn't require debugger context. | |
12217 RUNTIME_FUNCTION(MaybeObject*, Runtime_CollectGarbage2) { | |
Søren Thygesen Gjesse
2011/07/07 11:59:53
I don't see any difference between this and the ex
mnaganov (inactive)
2011/07/07 20:19:57
My bad. I was receiving "illegal access" error, an
| |
12218 isolate->heap()->CollectAllGarbage(true); | |
12219 return isolate->heap()->undefined_value(); | |
12220 } | |
12221 | |
12156 #endif // ENABLE_LOGGING_AND_PROFILING | 12222 #endif // ENABLE_LOGGING_AND_PROFILING |
12157 | 12223 |
12158 // Finds the script object from the script data. NOTE: This operation uses | 12224 // Finds the script object from the script data. NOTE: This operation uses |
12159 // heap traversal to find the function generated for the source position | 12225 // heap traversal to find the function generated for the source position |
12160 // for the requested break point. For lazily compiled functions several heap | 12226 // for the requested break point. For lazily compiled functions several heap |
12161 // traversals might be required rendering this operation as a rather slow | 12227 // traversals might be required rendering this operation as a rather slow |
12162 // operation. However for setting break points which is normally done through | 12228 // operation. However for setting break points which is normally done through |
12163 // some kind of user interaction the performance is not crucial. | 12229 // some kind of user interaction the performance is not crucial. |
12164 static Handle<Object> Runtime_GetScriptFromScriptName( | 12230 static Handle<Object> Runtime_GetScriptFromScriptName( |
12165 Handle<String> script_name) { | 12231 Handle<String> script_name) { |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12606 } else { | 12672 } else { |
12607 // Handle last resort GC and make sure to allow future allocations | 12673 // Handle last resort GC and make sure to allow future allocations |
12608 // to grow the heap without causing GCs (if possible). | 12674 // to grow the heap without causing GCs (if possible). |
12609 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12675 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12610 isolate->heap()->CollectAllGarbage(false); | 12676 isolate->heap()->CollectAllGarbage(false); |
12611 } | 12677 } |
12612 } | 12678 } |
12613 | 12679 |
12614 | 12680 |
12615 } } // namespace v8::internal | 12681 } } // namespace v8::internal |
OLD | NEW |