| 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 8503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8514 "};"); | 8514 "};"); |
| 8515 CHECK_EQ(239 * 10, value->Int32Value()); | 8515 CHECK_EQ(239 * 10, value->Int32Value()); |
| 8516 } | 8516 } |
| 8517 | 8517 |
| 8518 static v8::Handle<Value> InterceptorCallICFastApi(Local<String> name, | 8518 static v8::Handle<Value> InterceptorCallICFastApi(Local<String> name, |
| 8519 const AccessorInfo& info) { | 8519 const AccessorInfo& info) { |
| 8520 ApiTestFuzzer::Fuzz(); | 8520 ApiTestFuzzer::Fuzz(); |
| 8521 int* call_count = reinterpret_cast<int*>(v8::External::Unwrap(info.Data())); | 8521 int* call_count = reinterpret_cast<int*>(v8::External::Unwrap(info.Data())); |
| 8522 ++(*call_count); | 8522 ++(*call_count); |
| 8523 if ((*call_count) % 20 == 0) { | 8523 if ((*call_count) % 20 == 0) { |
| 8524 HEAP->CollectAllGarbage(i::Heap::kForceCompactionMask); | 8524 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 8525 } | 8525 } |
| 8526 return v8::Handle<Value>(); | 8526 return v8::Handle<Value>(); |
| 8527 } | 8527 } |
| 8528 | 8528 |
| 8529 static v8::Handle<Value> FastApiCallback_TrivialSignature( | 8529 static v8::Handle<Value> FastApiCallback_TrivialSignature( |
| 8530 const v8::Arguments& args) { | 8530 const v8::Arguments& args) { |
| 8531 ApiTestFuzzer::Fuzz(); | 8531 ApiTestFuzzer::Fuzz(); |
| 8532 CHECK_EQ(args.This(), args.Holder()); | 8532 CHECK_EQ(args.This(), args.Holder()); |
| 8533 CHECK(args.Data()->Equals(v8_str("method_data"))); | 8533 CHECK(args.Data()->Equals(v8_str("method_data"))); |
| 8534 return v8::Integer::New(args[0]->Int32Value() + 1); | 8534 return v8::Integer::New(args[0]->Int32Value() + 1); |
| (...skipping 5200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13735 | 13735 |
| 13736 reresult = CompileRun("str2.charCodeAt(2);"); | 13736 reresult = CompileRun("str2.charCodeAt(2);"); |
| 13737 CHECK_EQ(static_cast<int32_t>('e'), reresult->Int32Value()); | 13737 CHECK_EQ(static_cast<int32_t>('e'), reresult->Int32Value()); |
| 13738 } | 13738 } |
| 13739 | 13739 |
| 13740 | 13740 |
| 13741 // Failed access check callback that performs a GC on each invocation. | 13741 // Failed access check callback that performs a GC on each invocation. |
| 13742 void FailedAccessCheckCallbackGC(Local<v8::Object> target, | 13742 void FailedAccessCheckCallbackGC(Local<v8::Object> target, |
| 13743 v8::AccessType type, | 13743 v8::AccessType type, |
| 13744 Local<v8::Value> data) { | 13744 Local<v8::Value> data) { |
| 13745 HEAP->CollectAllGarbage(i::Heap::kForceCompactionMask); | 13745 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 13746 } | 13746 } |
| 13747 | 13747 |
| 13748 | 13748 |
| 13749 TEST(GCInFailedAccessCheckCallback) { | 13749 TEST(GCInFailedAccessCheckCallback) { |
| 13750 // Install a failed access check callback that performs a GC on each | 13750 // Install a failed access check callback that performs a GC on each |
| 13751 // invocation. Then force the callback to be called from va | 13751 // invocation. Then force the callback to be called from va |
| 13752 | 13752 |
| 13753 v8::V8::Initialize(); | 13753 v8::V8::Initialize(); |
| 13754 v8::V8::SetFailedAccessCheckCallbackFunction(&FailedAccessCheckCallbackGC); | 13754 v8::V8::SetFailedAccessCheckCallbackFunction(&FailedAccessCheckCallbackGC); |
| 13755 | 13755 |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14309 ExpectBoolean("delete cell", true); | 14309 ExpectBoolean("delete cell", true); |
| 14310 ExpectString("(function() {" | 14310 ExpectString("(function() {" |
| 14311 " try {" | 14311 " try {" |
| 14312 " return readCell();" | 14312 " return readCell();" |
| 14313 " } catch(e) {" | 14313 " } catch(e) {" |
| 14314 " return e.toString();" | 14314 " return e.toString();" |
| 14315 " }" | 14315 " }" |
| 14316 "})()", | 14316 "})()", |
| 14317 "ReferenceError: cell is not defined"); | 14317 "ReferenceError: cell is not defined"); |
| 14318 CompileRun("cell = \"new_second\";"); | 14318 CompileRun("cell = \"new_second\";"); |
| 14319 HEAP->CollectAllGarbage(i::Heap::kForceCompactionMask); | 14319 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 14320 ExpectString("readCell()", "new_second"); | 14320 ExpectString("readCell()", "new_second"); |
| 14321 ExpectString("readCell()", "new_second"); | 14321 ExpectString("readCell()", "new_second"); |
| 14322 } | 14322 } |
| 14323 } | 14323 } |
| 14324 | 14324 |
| 14325 | 14325 |
| 14326 TEST(DontDeleteCellLoadICForceDelete) { | 14326 TEST(DontDeleteCellLoadICForceDelete) { |
| 14327 const char* function_code = | 14327 const char* function_code = |
| 14328 "function readCell() { while (true) { return cell; } }"; | 14328 "function readCell() { while (true) { return cell; } }"; |
| 14329 | 14329 |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14846 } | 14846 } |
| 14847 | 14847 |
| 14848 i::Isolate::Current()->heap()->CollectAllGarbage(true); | 14848 i::Isolate::Current()->heap()->CollectAllGarbage(true); |
| 14849 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); | 14849 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); |
| 14850 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { | 14850 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { |
| 14851 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); | 14851 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); |
| 14852 CHECK_GT(elements, map_cache->NumberOfElements()); | 14852 CHECK_GT(elements, map_cache->NumberOfElements()); |
| 14853 } | 14853 } |
| 14854 } | 14854 } |
| 14855 } | 14855 } |
| OLD | NEW |