| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 70   Handle<String> source_code(Factory::NewStringFromUtf8(CStrVector(source))); | 70   Handle<String> source_code(Factory::NewStringFromUtf8(CStrVector(source))); | 
| 71   Handle<JSFunction> boilerplate = | 71   Handle<JSFunction> boilerplate = | 
| 72       Compiler::Compile(source_code, Handle<String>(), 0, 0, NULL, NULL); | 72       Compiler::Compile(source_code, Handle<String>(), 0, 0, NULL, NULL); | 
| 73   return Factory::NewFunctionFromBoilerplate(boilerplate, | 73   return Factory::NewFunctionFromBoilerplate(boilerplate, | 
| 74                                              Top::global_context()); | 74                                              Top::global_context()); | 
| 75 } | 75 } | 
| 76 | 76 | 
| 77 | 77 | 
| 78 static double Inc(int x) { | 78 static double Inc(int x) { | 
| 79   const char* source = "result = %d + 1;"; | 79   const char* source = "result = %d + 1;"; | 
| 80   char buffer[512]; | 80   EmbeddedVector<char, 512> buffer; | 
| 81   OS::SNPrintF(buffer, sizeof(buffer), source, x); | 81   OS::SNPrintF(buffer, source, x); | 
| 82 | 82 | 
| 83   Handle<JSFunction> fun = Compile(buffer); | 83   Handle<JSFunction> fun = Compile(buffer.start()); | 
| 84   if (fun.is_null()) return -1; | 84   if (fun.is_null()) return -1; | 
| 85 | 85 | 
| 86   bool has_pending_exception; | 86   bool has_pending_exception; | 
| 87   Handle<JSObject> global(Top::context()->global()); | 87   Handle<JSObject> global(Top::context()->global()); | 
| 88   Execution::Call(fun, global, 0, NULL, &has_pending_exception); | 88   Execution::Call(fun, global, 0, NULL, &has_pending_exception); | 
| 89   CHECK(!has_pending_exception); | 89   CHECK(!has_pending_exception); | 
| 90   return GetGlobalProperty("result")->Number(); | 90   return GetGlobalProperty("result")->Number(); | 
| 91 } | 91 } | 
| 92 | 92 | 
| 93 | 93 | 
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 250               *Factory::LookupAsciiSymbol("foo"))); | 250               *Factory::LookupAsciiSymbol("foo"))); | 
| 251   CHECK(fun1->IsJSFunction()); | 251   CHECK(fun1->IsJSFunction()); | 
| 252 | 252 | 
| 253   Object** argv[1] = { | 253   Object** argv[1] = { | 
| 254     Handle<Object>::cast(Factory::LookupAsciiSymbol("hello")).location() | 254     Handle<Object>::cast(Factory::LookupAsciiSymbol("hello")).location() | 
| 255   }; | 255   }; | 
| 256   Execution::Call(Handle<JSFunction>::cast(fun1), global, 1, argv, | 256   Execution::Call(Handle<JSFunction>::cast(fun1), global, 1, argv, | 
| 257                   &has_pending_exception); | 257                   &has_pending_exception); | 
| 258   CHECK(!has_pending_exception); | 258   CHECK(!has_pending_exception); | 
| 259 } | 259 } | 
| OLD | NEW | 
|---|