Chromium Code Reviews| 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 11405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11416 // Compute some fibonacci numbers on 3 threads in 3 isolates. | 11416 // Compute some fibonacci numbers on 3 threads in 3 isolates. |
| 11417 thread1.Start(); | 11417 thread1.Start(); |
| 11418 thread2.Start(); | 11418 thread2.Start(); |
| 11419 | 11419 |
| 11420 int result1 = CalcFibonacci(v8::Isolate::GetCurrent(), 21); | 11420 int result1 = CalcFibonacci(v8::Isolate::GetCurrent(), 21); |
| 11421 int result2 = CalcFibonacci(v8::Isolate::GetCurrent(), 12); | 11421 int result2 = CalcFibonacci(v8::Isolate::GetCurrent(), 12); |
| 11422 | 11422 |
| 11423 thread1.Join(); | 11423 thread1.Join(); |
| 11424 thread2.Join(); | 11424 thread2.Join(); |
| 11425 | 11425 |
| 11426 // Compare results. | 11426 // Compare results. The actual fibonacci numbers for 12 and 21 are taken |
| 11427 // (I'm lazy!) from http://en.wikipedia.org/wiki/Fibonacci_number | |
|
Vitaly Repeshko
2010/08/06 20:43:14
http://www.wolframalpha.com/input/?i=fibonacci+21
| |
| 11428 CHECK(result1 == 10946); | |
| 11429 CHECK(result2 == 144); | |
| 11427 CHECK(result1 == thread1.result()); | 11430 CHECK(result1 == thread1.result()); |
| 11428 CHECK(result2 == thread2.result()); | 11431 CHECK(result2 == thread2.result()); |
| 11429 | 11432 |
| 11430 isolate1->Dispose(); | 11433 isolate1->Dispose(); |
| 11431 isolate2->Dispose(); | 11434 isolate2->Dispose(); |
| 11432 } | 11435 } |
| 11433 | 11436 |
| 11434 | 11437 |
| OLD | NEW |