| 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 14020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14031 " try {" | 14031 " try {" |
| 14032 " return readCell();" | 14032 " return readCell();" |
| 14033 " } catch(e) {" | 14033 " } catch(e) {" |
| 14034 " return e.toString();" | 14034 " return e.toString();" |
| 14035 " }" | 14035 " }" |
| 14036 "})()", | 14036 "})()", |
| 14037 "ReferenceError: cell is not defined"); | 14037 "ReferenceError: cell is not defined"); |
| 14038 } | 14038 } |
| 14039 | 14039 |
| 14040 | 14040 |
| 14041 TEST(GlobalLoadICGC) { | |
| 14042 const char* function_code = | |
| 14043 "function readCell() { while (true) { return cell; } }"; | |
| 14044 | |
| 14045 // Check inline load code for a don't delete cell is cleared during | |
| 14046 // GC. | |
| 14047 { | |
| 14048 v8::HandleScope scope; | |
| 14049 LocalContext context; | |
| 14050 CompileRun("var cell = \"value\";"); | |
| 14051 ExpectBoolean("delete cell", false); | |
| 14052 CompileRun(function_code); | |
| 14053 ExpectString("readCell()", "value"); | |
| 14054 ExpectString("readCell()", "value"); | |
| 14055 } | |
| 14056 { | |
| 14057 v8::HandleScope scope; | |
| 14058 LocalContext context2; | |
| 14059 // Hold the code object in the second context. | |
| 14060 CompileRun(function_code); | |
| 14061 CheckSurvivingGlobalObjectsCount(1); | |
| 14062 } | |
| 14063 | |
| 14064 // Check inline load code for a deletable cell is cleared during GC. | |
| 14065 { | |
| 14066 v8::HandleScope scope; | |
| 14067 LocalContext context; | |
| 14068 CompileRun("cell = \"value\";"); | |
| 14069 CompileRun(function_code); | |
| 14070 ExpectString("readCell()", "value"); | |
| 14071 ExpectString("readCell()", "value"); | |
| 14072 } | |
| 14073 { | |
| 14074 v8::HandleScope scope; | |
| 14075 LocalContext context2; | |
| 14076 // Hold the code object in the second context. | |
| 14077 CompileRun(function_code); | |
| 14078 CheckSurvivingGlobalObjectsCount(1); | |
| 14079 } | |
| 14080 } | |
| 14081 | |
| 14082 | |
| 14083 TEST(RegExp) { | 14041 TEST(RegExp) { |
| 14084 v8::HandleScope scope; | 14042 v8::HandleScope scope; |
| 14085 LocalContext context; | 14043 LocalContext context; |
| 14086 | 14044 |
| 14087 v8::Handle<v8::RegExp> re = v8::RegExp::New(v8_str("foo"), v8::RegExp::kNone); | 14045 v8::Handle<v8::RegExp> re = v8::RegExp::New(v8_str("foo"), v8::RegExp::kNone); |
| 14088 CHECK(re->IsRegExp()); | 14046 CHECK(re->IsRegExp()); |
| 14089 CHECK(re->GetSource()->Equals(v8_str("foo"))); | 14047 CHECK(re->GetSource()->Equals(v8_str("foo"))); |
| 14090 CHECK_EQ(re->GetFlags(), v8::RegExp::kNone); | 14048 CHECK_EQ(re->GetFlags(), v8::RegExp::kNone); |
| 14091 | 14049 |
| 14092 re = v8::RegExp::New(v8_str("bar"), | 14050 re = v8::RegExp::New(v8_str("bar"), |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14500 | 14458 |
| 14501 THREADED_TEST(CallAPIFunctionOnNonObject) { | 14459 THREADED_TEST(CallAPIFunctionOnNonObject) { |
| 14502 v8::HandleScope scope; | 14460 v8::HandleScope scope; |
| 14503 LocalContext context; | 14461 LocalContext context; |
| 14504 Handle<FunctionTemplate> templ = v8::FunctionTemplate::New(NonObjectThis); | 14462 Handle<FunctionTemplate> templ = v8::FunctionTemplate::New(NonObjectThis); |
| 14505 Handle<Function> function = templ->GetFunction(); | 14463 Handle<Function> function = templ->GetFunction(); |
| 14506 context->Global()->Set(v8_str("f"), function); | 14464 context->Global()->Set(v8_str("f"), function); |
| 14507 TryCatch try_catch; | 14465 TryCatch try_catch; |
| 14508 CompileRun("f.call(2)"); | 14466 CompileRun("f.call(2)"); |
| 14509 } | 14467 } |
| OLD | NEW |