| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 static Object* Runtime_RegExpCompile(Arguments args) { | 290 static Object* Runtime_RegExpCompile(Arguments args) { |
| 291 HandleScope scope; // create a new handle scope | 291 HandleScope scope; // create a new handle scope |
| 292 ASSERT(args.length() == 3); | 292 ASSERT(args.length() == 3); |
| 293 CONVERT_CHECKED(JSRegExp, raw_re, args[0]); | 293 CONVERT_CHECKED(JSRegExp, raw_re, args[0]); |
| 294 Handle<JSRegExp> re(raw_re); | 294 Handle<JSRegExp> re(raw_re); |
| 295 CONVERT_CHECKED(String, raw_pattern, args[1]); | 295 CONVERT_CHECKED(String, raw_pattern, args[1]); |
| 296 Handle<String> pattern(raw_pattern); | 296 Handle<String> pattern(raw_pattern); |
| 297 CONVERT_CHECKED(String, raw_flags, args[2]); | 297 CONVERT_CHECKED(String, raw_flags, args[2]); |
| 298 Handle<String> flags(raw_flags); | 298 Handle<String> flags(raw_flags); |
| 299 return *RegExpImpl::Compile(re, pattern, flags); | 299 Handle<Object> result = RegExpImpl::Compile(re, pattern, flags); |
| 300 if (result.is_null()) return Failure::Exception(); |
| 301 return *result; |
| 300 } | 302 } |
| 301 | 303 |
| 302 | 304 |
| 303 static Object* Runtime_CreateApiFunction(Arguments args) { | 305 static Object* Runtime_CreateApiFunction(Arguments args) { |
| 304 HandleScope scope; | 306 HandleScope scope; |
| 305 ASSERT(args.length() == 1); | 307 ASSERT(args.length() == 1); |
| 306 CONVERT_CHECKED(FunctionTemplateInfo, raw_data, args[0]); | 308 CONVERT_CHECKED(FunctionTemplateInfo, raw_data, args[0]); |
| 307 Handle<FunctionTemplateInfo> data(raw_data); | 309 Handle<FunctionTemplateInfo> data(raw_data); |
| 308 return *Factory::CreateApiFunction(data); | 310 return *Factory::CreateApiFunction(data); |
| 309 } | 311 } |
| (...skipping 5079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5389 if (boilerplate.is_null()) return Failure::Exception(); | 5391 if (boilerplate.is_null()) return Failure::Exception(); |
| 5390 Handle<JSFunction> compiled_function = | 5392 Handle<JSFunction> compiled_function = |
| 5391 Factory::NewFunctionFromBoilerplate(boilerplate, context); | 5393 Factory::NewFunctionFromBoilerplate(boilerplate, context); |
| 5392 | 5394 |
| 5393 // Invoke the result of the compilation to get the evaluation function. | 5395 // Invoke the result of the compilation to get the evaluation function. |
| 5394 bool has_pending_exception; | 5396 bool has_pending_exception; |
| 5395 Handle<Object> receiver(frame->receiver()); | 5397 Handle<Object> receiver(frame->receiver()); |
| 5396 Handle<Object> evaluation_function = | 5398 Handle<Object> evaluation_function = |
| 5397 Execution::Call(compiled_function, receiver, 0, NULL, | 5399 Execution::Call(compiled_function, receiver, 0, NULL, |
| 5398 &has_pending_exception); | 5400 &has_pending_exception); |
| 5401 if (has_pending_exception) return Failure::Exception(); |
| 5399 | 5402 |
| 5400 Handle<Object> arguments = GetArgumentsObject(frame, function, code, &sinfo, | 5403 Handle<Object> arguments = GetArgumentsObject(frame, function, code, &sinfo, |
| 5401 function_context); | 5404 function_context); |
| 5402 | 5405 |
| 5403 // Invoke the evaluation function and return the result. | 5406 // Invoke the evaluation function and return the result. |
| 5404 const int argc = 2; | 5407 const int argc = 2; |
| 5405 Object** argv[argc] = { arguments.location(), | 5408 Object** argv[argc] = { arguments.location(), |
| 5406 Handle<Object>::cast(source).location() }; | 5409 Handle<Object>::cast(source).location() }; |
| 5407 Handle<Object> result = | 5410 Handle<Object> result = |
| 5408 Execution::Call(Handle<JSFunction>::cast(evaluation_function), receiver, | 5411 Execution::Call(Handle<JSFunction>::cast(evaluation_function), receiver, |
| 5409 argc, argv, &has_pending_exception); | 5412 argc, argv, &has_pending_exception); |
| 5413 if (has_pending_exception) return Failure::Exception(); |
| 5410 return *result; | 5414 return *result; |
| 5411 } | 5415 } |
| 5412 | 5416 |
| 5413 | 5417 |
| 5414 static Object* Runtime_DebugEvaluateGlobal(Arguments args) { | 5418 static Object* Runtime_DebugEvaluateGlobal(Arguments args) { |
| 5415 HandleScope scope; | 5419 HandleScope scope; |
| 5416 | 5420 |
| 5417 // Check the execution state and decode arguments frame and source to be | 5421 // Check the execution state and decode arguments frame and source to be |
| 5418 // evaluated. | 5422 // evaluated. |
| 5419 ASSERT(args.length() == 3); | 5423 ASSERT(args.length() == 3); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 5445 Handle<JSFunction> compiled_function = | 5449 Handle<JSFunction> compiled_function = |
| 5446 Handle<JSFunction>(Factory::NewFunctionFromBoilerplate(boilerplate, | 5450 Handle<JSFunction>(Factory::NewFunctionFromBoilerplate(boilerplate, |
| 5447 context)); | 5451 context)); |
| 5448 | 5452 |
| 5449 // Invoke the result of the compilation to get the evaluation function. | 5453 // Invoke the result of the compilation to get the evaluation function. |
| 5450 bool has_pending_exception; | 5454 bool has_pending_exception; |
| 5451 Handle<Object> receiver = Top::global(); | 5455 Handle<Object> receiver = Top::global(); |
| 5452 Handle<Object> result = | 5456 Handle<Object> result = |
| 5453 Execution::Call(compiled_function, receiver, 0, NULL, | 5457 Execution::Call(compiled_function, receiver, 0, NULL, |
| 5454 &has_pending_exception); | 5458 &has_pending_exception); |
| 5459 if (has_pending_exception) return Failure::Exception(); |
| 5455 return *result; | 5460 return *result; |
| 5456 } | 5461 } |
| 5457 | 5462 |
| 5458 | 5463 |
| 5459 // Helper function used by Runtime_DebugGetLoadedScripts below. | 5464 // Helper function used by Runtime_DebugGetLoadedScripts below. |
| 5460 static int DebugGetLoadedScripts(FixedArray* instances, int instances_size) { | 5465 static int DebugGetLoadedScripts(FixedArray* instances, int instances_size) { |
| 5461 NoHandleAllocation ha; | 5466 NoHandleAllocation ha; |
| 5462 AssertNoAllocation no_alloc; | 5467 AssertNoAllocation no_alloc; |
| 5463 | 5468 |
| 5464 // Get hold of the current empty script. | 5469 // Get hold of the current empty script. |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5871 } else { | 5876 } else { |
| 5872 // Handle last resort GC and make sure to allow future allocations | 5877 // Handle last resort GC and make sure to allow future allocations |
| 5873 // to grow the heap without causing GCs (if possible). | 5878 // to grow the heap without causing GCs (if possible). |
| 5874 Counters::gc_last_resort_from_js.Increment(); | 5879 Counters::gc_last_resort_from_js.Increment(); |
| 5875 Heap::CollectAllGarbage(); | 5880 Heap::CollectAllGarbage(); |
| 5876 } | 5881 } |
| 5877 } | 5882 } |
| 5878 | 5883 |
| 5879 | 5884 |
| 5880 } } // namespace v8::internal | 5885 } } // namespace v8::internal |
| OLD | NEW |