Chromium Code Reviews| Index: src/runtime.cc |
| diff --git a/src/runtime.cc b/src/runtime.cc |
| index 313158149aee6c3cbb46b6700d1fe3cab1b00f71..23624f13aff96323ee9e9552b3179bcc0a462b4d 100644 |
| --- a/src/runtime.cc |
| +++ b/src/runtime.cc |
| @@ -12153,6 +12153,72 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ProfilerPause) { |
| return isolate->heap()->undefined_value(); |
| } |
| + |
| +static v8::Handle<v8::Value> EmptyMethod(const v8::Arguments& args) { |
| + return v8::Handle<v8::Value>(); |
| +} |
| + |
|
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'
|
| +RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateClassWithCallback) { |
| + ASSERT(args.length() == 2); |
| + CONVERT_ARG_CHECKED(String, className, 0); |
| + CONVERT_ARG_CHECKED(String, methodName, 1); |
| + v8::HandleScope scope; |
| + v8::Handle<v8::FunctionTemplate> obj = v8::FunctionTemplate::New(); |
| + obj->SetClassName(v8::Handle<v8::String>(ToApi<v8::String>(className))); |
| + v8::Handle<v8::ObjectTemplate> proto(obj->PrototypeTemplate()); |
| + v8::Local<v8::Signature> signature = v8::Signature::New(obj); |
| + proto->Set( |
| + v8::Handle<v8::String>(ToApi<v8::String>(methodName)), |
| + v8::FunctionTemplate::New(EmptyMethod, |
| + v8::Handle<v8::Value>(), |
| + signature), |
| + static_cast<v8::PropertyAttribute>(v8::DontDelete)); |
| + return *Utils::OpenHandle(*obj->GetFunction()); |
| +} |
| + |
| + |
| +static v8::Handle<v8::Value> EmptyGetter(v8::Local<v8::String> property, |
| + const v8::AccessorInfo& info) { |
| + return v8::Handle<v8::Value>(); |
| +} |
| + |
| +static void EmptySetter(v8::Local<v8::String> property, |
| + v8::Local<v8::Value> value, |
| + const v8::AccessorInfo& info) { |
| +} |
| + |
| +RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateClassWithGetterAndSetter) { |
| + ASSERT(args.length() == 3); |
| + CONVERT_ARG_CHECKED(String, className, 0); |
| + CONVERT_ARG_CHECKED(String, property1Name, 1); |
| + CONVERT_ARG_CHECKED(String, property2Name, 2); |
| + v8::HandleScope scope; |
| + v8::Handle<v8::FunctionTemplate> obj = v8::FunctionTemplate::New(); |
| + obj->SetClassName(v8::Handle<v8::String>(ToApi<v8::String>(className))); |
| + v8::Handle<v8::ObjectTemplate> inst = obj->InstanceTemplate(); |
| + inst->SetAccessor(v8::Handle<v8::String>(ToApi<v8::String>(property1Name)), |
| + EmptyGetter, |
| + EmptySetter); |
| + inst->SetAccessor(v8::Handle<v8::String>(ToApi<v8::String>(property2Name)), |
| + EmptyGetter); |
| + return *Utils::OpenHandle(*obj->GetFunction()); |
| +} |
| + |
| +RUNTIME_FUNCTION(MaybeObject*, Runtime_LogCompiledFunctions) { |
| + bool old_log_code = FLAG_log_code; |
| + FLAG_log_code = true; |
| + isolate->logger()->LogCompiledFunctions(); |
| + isolate->logger()->LogAccessorCallbacks(); |
| + FLAG_log_code = old_log_code; |
| + return isolate->heap()->undefined_value(); |
| +} |
| + |
| +// Doesn't require debugger context. |
| +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
|
| + isolate->heap()->CollectAllGarbage(true); |
| + return isolate->heap()->undefined_value(); |
| +} |
| + |
| #endif // ENABLE_LOGGING_AND_PROFILING |
| // Finds the script object from the script data. NOTE: This operation uses |