OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 6259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6270 CHECK(fun1->shared() == fun2->shared()); | 6270 CHECK(fun1->shared() == fun2->shared()); |
6271 } | 6271 } |
6272 | 6272 |
6273 | 6273 |
6274 static void RemoveCodeAndGC(const v8::FunctionCallbackInfo<v8::Value>& args) { | 6274 static void RemoveCodeAndGC(const v8::FunctionCallbackInfo<v8::Value>& args) { |
6275 Isolate* isolate = CcTest::i_isolate(); | 6275 Isolate* isolate = CcTest::i_isolate(); |
6276 Handle<Object> obj = v8::Utils::OpenHandle(*args[0]); | 6276 Handle<Object> obj = v8::Utils::OpenHandle(*args[0]); |
6277 Handle<JSFunction> fun = Handle<JSFunction>::cast(obj); | 6277 Handle<JSFunction> fun = Handle<JSFunction>::cast(obj); |
6278 fun->ReplaceCode(*isolate->builtins()->CompileLazy()); | 6278 fun->ReplaceCode(*isolate->builtins()->CompileLazy()); |
6279 fun->shared()->ReplaceCode(*isolate->builtins()->CompileLazy()); | 6279 fun->shared()->ReplaceCode(*isolate->builtins()->CompileLazy()); |
| 6280 fun->shared()->ClearBytecodeArray(); // Bytecode is code too. |
6280 isolate->heap()->CollectAllAvailableGarbage("remove code and gc"); | 6281 isolate->heap()->CollectAllAvailableGarbage("remove code and gc"); |
6281 } | 6282 } |
6282 | 6283 |
6283 | 6284 |
6284 TEST(CanonicalSharedFunctionInfo) { | 6285 TEST(CanonicalSharedFunctionInfo) { |
6285 CcTest::InitializeVM(); | 6286 CcTest::InitializeVM(); |
6286 v8::Isolate* isolate = CcTest::isolate(); | 6287 v8::Isolate* isolate = CcTest::isolate(); |
6287 v8::HandleScope scope(isolate); | 6288 v8::HandleScope scope(isolate); |
6288 v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); | 6289 v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); |
6289 global->Set(isolate, "check", v8::FunctionTemplate::New( | 6290 global->Set(isolate, "check", v8::FunctionTemplate::New( |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6526 byte_array->set(j, 0x31); | 6527 byte_array->set(j, 0x31); |
6527 } | 6528 } |
6528 } | 6529 } |
6529 // Re-enable old space expansion to avoid OOM crash. | 6530 // Re-enable old space expansion to avoid OOM crash. |
6530 heap->set_force_oom(false); | 6531 heap->set_force_oom(false); |
6531 heap->CollectGarbage(NEW_SPACE); | 6532 heap->CollectGarbage(NEW_SPACE); |
6532 } | 6533 } |
6533 | 6534 |
6534 } // namespace internal | 6535 } // namespace internal |
6535 } // namespace v8 | 6536 } // namespace v8 |
OLD | NEW |