| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 27 matching lines...) Expand all Loading... |
| 38 namespace i = ::v8::internal; | 38 namespace i = ::v8::internal; |
| 39 | 39 |
| 40 TEST(MIPSFunctionCalls) { | 40 TEST(MIPSFunctionCalls) { |
| 41 // Disable compilation of natives. | 41 // Disable compilation of natives. |
| 42 i::FLAG_disable_native_files = true; | 42 i::FLAG_disable_native_files = true; |
| 43 i::FLAG_full_compiler = false; | 43 i::FLAG_full_compiler = false; |
| 44 | 44 |
| 45 v8::HandleScope scope; | 45 v8::HandleScope scope; |
| 46 LocalContext env; // from cctest.h | 46 LocalContext env; // from cctest.h |
| 47 | 47 |
| 48 const char* c_source = "function foo() { return 0x1234; }; foo();"; | 48 const char* c_source_1 = |
| 49 Local<String> source = ::v8::String::New(c_source); | 49 "function foo() {" |
| 50 Local<Script> script = ::v8::Script::Compile(source); | 50 " return 0xabcd;" |
| 51 CHECK_EQ(0x1234, script->Run()->Int32Value()); | 51 "}" |
| 52 "foo();"; |
| 53 Local<String> source_1 = ::v8::String::New(c_source_1); |
| 54 Local<Script> script_1 = ::v8::Script::Compile(source_1); |
| 55 CHECK_EQ(0xabcd, script_1->Run()->Int32Value()); |
| 56 |
| 57 |
| 58 const char* c_source_2 = |
| 59 "function foo1(arg1, arg2, arg3, arg4, arg5) {" |
| 60 " return foo2(arg1, foo2(arg3, arg4));" |
| 61 "}" |
| 62 "" |
| 63 "function foo2(arg1, arg2) {" |
| 64 " return arg2;" |
| 65 "}" |
| 66 "foo1(1, 2, 3, 4, 5);"; |
| 67 |
| 68 Local<String> source_2 = ::v8::String::New(c_source_2); |
| 69 Local<Script> script_2 = ::v8::Script::Compile(source_2); |
| 70 CHECK_EQ(4, script_2->Run()->Int32Value()); |
| 52 } | 71 } |
| OLD | NEW |