OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 9911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9922 CHECK(regexp_success_); | 9922 CHECK(regexp_success_); |
9923 CHECK(gc_success_); | 9923 CHECK(gc_success_); |
9924 } | 9924 } |
9925 private: | 9925 private: |
9926 // Number of garbage collections required. | 9926 // Number of garbage collections required. |
9927 static const int kRequiredGCs = 5; | 9927 static const int kRequiredGCs = 5; |
9928 | 9928 |
9929 class GCThread : public i::Thread { | 9929 class GCThread : public i::Thread { |
9930 public: | 9930 public: |
9931 explicit GCThread(i::Isolate* isolate, RegExpInterruptTest* test) | 9931 explicit GCThread(i::Isolate* isolate, RegExpInterruptTest* test) |
9932 : Thread(isolate), test_(test) {} | 9932 : Thread(isolate, "GCThread"), test_(test) {} |
9933 virtual void Run() { | 9933 virtual void Run() { |
9934 test_->CollectGarbage(); | 9934 test_->CollectGarbage(); |
9935 } | 9935 } |
9936 private: | 9936 private: |
9937 RegExpInterruptTest* test_; | 9937 RegExpInterruptTest* test_; |
9938 }; | 9938 }; |
9939 | 9939 |
9940 void CollectGarbage() { | 9940 void CollectGarbage() { |
9941 block_->Wait(); | 9941 block_->Wait(); |
9942 while (gc_during_regexp_ < kRequiredGCs) { | 9942 while (gc_during_regexp_ < kRequiredGCs) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10044 CHECK(apply_success_); | 10044 CHECK(apply_success_); |
10045 CHECK(gc_success_); | 10045 CHECK(gc_success_); |
10046 } | 10046 } |
10047 private: | 10047 private: |
10048 // Number of garbage collections required. | 10048 // Number of garbage collections required. |
10049 static const int kRequiredGCs = 2; | 10049 static const int kRequiredGCs = 2; |
10050 | 10050 |
10051 class GCThread : public i::Thread { | 10051 class GCThread : public i::Thread { |
10052 public: | 10052 public: |
10053 explicit GCThread(i::Isolate* isolate, ApplyInterruptTest* test) | 10053 explicit GCThread(i::Isolate* isolate, ApplyInterruptTest* test) |
10054 : Thread(isolate), test_(test) {} | 10054 : Thread(isolate, "GCThread"), test_(test) {} |
10055 virtual void Run() { | 10055 virtual void Run() { |
10056 test_->CollectGarbage(); | 10056 test_->CollectGarbage(); |
10057 } | 10057 } |
10058 private: | 10058 private: |
10059 ApplyInterruptTest* test_; | 10059 ApplyInterruptTest* test_; |
10060 }; | 10060 }; |
10061 | 10061 |
10062 void CollectGarbage() { | 10062 void CollectGarbage() { |
10063 block_->Wait(); | 10063 block_->Wait(); |
10064 while (gc_during_apply_ < kRequiredGCs) { | 10064 while (gc_during_apply_ < kRequiredGCs) { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10340 private: | 10340 private: |
10341 | 10341 |
10342 // Number of string modifications required. | 10342 // Number of string modifications required. |
10343 static const int kRequiredModifications = 5; | 10343 static const int kRequiredModifications = 5; |
10344 static const int kMaxModifications = 100; | 10344 static const int kMaxModifications = 100; |
10345 | 10345 |
10346 class MorphThread : public i::Thread { | 10346 class MorphThread : public i::Thread { |
10347 public: | 10347 public: |
10348 explicit MorphThread(i::Isolate* isolate, | 10348 explicit MorphThread(i::Isolate* isolate, |
10349 RegExpStringModificationTest* test) | 10349 RegExpStringModificationTest* test) |
10350 : Thread(isolate), test_(test) {} | 10350 : Thread(isolate, "MorphThread"), test_(test) {} |
10351 virtual void Run() { | 10351 virtual void Run() { |
10352 test_->MorphString(); | 10352 test_->MorphString(); |
10353 } | 10353 } |
10354 private: | 10354 private: |
10355 RegExpStringModificationTest* test_; | 10355 RegExpStringModificationTest* test_; |
10356 }; | 10356 }; |
10357 | 10357 |
10358 void MorphString() { | 10358 void MorphString() { |
10359 block_->Wait(); | 10359 block_->Wait(); |
10360 while (morphs_during_regexp_ < kRequiredModifications && | 10360 while (morphs_during_regexp_ < kRequiredModifications && |
(...skipping 2676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13037 "}" | 13037 "}" |
13038 "fib(%d)", limit); | 13038 "fib(%d)", limit); |
13039 Local<Value> value = CompileRun(code.start()); | 13039 Local<Value> value = CompileRun(code.start()); |
13040 CHECK(value->IsNumber()); | 13040 CHECK(value->IsNumber()); |
13041 return static_cast<int>(value->NumberValue()); | 13041 return static_cast<int>(value->NumberValue()); |
13042 } | 13042 } |
13043 | 13043 |
13044 class IsolateThread : public v8::internal::Thread { | 13044 class IsolateThread : public v8::internal::Thread { |
13045 public: | 13045 public: |
13046 explicit IsolateThread(v8::Isolate* isolate, int fib_limit) | 13046 explicit IsolateThread(v8::Isolate* isolate, int fib_limit) |
13047 : Thread(NULL), | 13047 : Thread(NULL, "IsolateThread"), |
13048 isolate_(isolate), | 13048 isolate_(isolate), |
13049 fib_limit_(fib_limit), | 13049 fib_limit_(fib_limit), |
13050 result_(0) { } | 13050 result_(0) { } |
13051 | 13051 |
13052 void Run() { | 13052 void Run() { |
13053 result_ = CalcFibonacci(isolate_, fib_limit_); | 13053 result_ = CalcFibonacci(isolate_, fib_limit_); |
13054 } | 13054 } |
13055 | 13055 |
13056 int result() { return result_; } | 13056 int result() { return result_; } |
13057 | 13057 |
13058 private: | 13058 private: |
13059 v8::Isolate* isolate_; | 13059 v8::Isolate* isolate_; |
13060 int fib_limit_; | 13060 int fib_limit_; |
(...skipping 27 matching lines...) Expand all Loading... |
13088 isolate1->Dispose(); | 13088 isolate1->Dispose(); |
13089 isolate2->Dispose(); | 13089 isolate2->Dispose(); |
13090 } | 13090 } |
13091 | 13091 |
13092 | 13092 |
13093 class InitDefaultIsolateThread : public v8::internal::Thread { | 13093 class InitDefaultIsolateThread : public v8::internal::Thread { |
13094 public: | 13094 public: |
13095 enum TestCase { IgnoreOOM, SetResourceConstraints, SetFatalHandler }; | 13095 enum TestCase { IgnoreOOM, SetResourceConstraints, SetFatalHandler }; |
13096 | 13096 |
13097 explicit InitDefaultIsolateThread(TestCase testCase) | 13097 explicit InitDefaultIsolateThread(TestCase testCase) |
13098 : Thread(NULL), | 13098 : Thread(NULL, "InitDefaultIsolateThread"), |
13099 testCase_(testCase), | 13099 testCase_(testCase), |
13100 result_(false) { } | 13100 result_(false) { } |
13101 | 13101 |
13102 void Run() { | 13102 void Run() { |
13103 switch (testCase_) { | 13103 switch (testCase_) { |
13104 case IgnoreOOM: | 13104 case IgnoreOOM: |
13105 v8::V8::IgnoreOutOfMemoryException(); | 13105 v8::V8::IgnoreOutOfMemoryException(); |
13106 break; | 13106 break; |
13107 | 13107 |
13108 case SetResourceConstraints: { | 13108 case SetResourceConstraints: { |
13109 static const int K = 1024; | 13109 static const int K = 1024; |
13110 v8::ResourceConstraints constraints; | 13110 v8::ResourceConstraints constraints; |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13475 v8::Handle<v8::Function> define_property = | 13475 v8::Handle<v8::Function> define_property = |
13476 CompileRun("(function() {" | 13476 CompileRun("(function() {" |
13477 " Object.defineProperty(" | 13477 " Object.defineProperty(" |
13478 " this," | 13478 " this," |
13479 " 1," | 13479 " 1," |
13480 " { configurable: true, enumerable: true, value: 3 });" | 13480 " { configurable: true, enumerable: true, value: 3 });" |
13481 "})").As<Function>(); | 13481 "})").As<Function>(); |
13482 context->DetachGlobal(); | 13482 context->DetachGlobal(); |
13483 define_property->Call(proxy, 0, NULL); | 13483 define_property->Call(proxy, 0, NULL); |
13484 } | 13484 } |
OLD | NEW |