| Index: src/deoptimizer.cc
|
| diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc
|
| index 2b39ff6965e89a1290c03d1af0ea33c20c2c963a..27ec5f0fc286a4b6d602da6b9e5c97c2225b1e6e 100644
|
| --- a/src/deoptimizer.cc
|
| +++ b/src/deoptimizer.cc
|
| @@ -690,14 +690,17 @@ int Deoptimizer::GetDeoptimizationId(Isolate* isolate,
|
| int Deoptimizer::GetOutputInfo(DeoptimizationOutputData* data,
|
| BailoutId id,
|
| SharedFunctionInfo* shared) {
|
| - // TODO(kasperl): For now, we do a simple linear search for the PC
|
| - // offset associated with the given node id. This should probably be
|
| - // changed to a binary search.
|
| int length = data->DeoptPoints();
|
| - for (int i = 0; i < length; i++) {
|
| - if (data->AstId(i) == id) {
|
| - return data->PcAndState(i)->value();
|
| - }
|
| + int low = 0, high = length - 1, mid;
|
| + while (low <= high) {
|
| + mid = low + (high - low) / 2;
|
| + if (id == data->AstId(mid)) {
|
| + return data->PcAndState(mid)->value();
|
| + } else if (id < data->AstId(mid)) {
|
| + high = mid - 1;
|
| + } else {
|
| + low = mid + 1;
|
| + }
|
| }
|
| PrintF(stderr, "[couldn't find pc offset for node=%d]\n", id.ToInt());
|
| PrintF(stderr, "[method: %s]\n", shared->DebugName()->ToCString().get());
|
|
|