| 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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 // each byte to indicate whether or not more bytes follow. | 1184 // each byte to indicate whether or not more bytes follow. |
| 1185 do { | 1185 do { |
| 1186 uint32_t next = bits >> 7; | 1186 uint32_t next = bits >> 7; |
| 1187 contents_.Add(((bits << 1) & 0xFF) | (next != 0)); | 1187 contents_.Add(((bits << 1) & 0xFF) | (next != 0)); |
| 1188 bits = next; | 1188 bits = next; |
| 1189 } while (bits != 0); | 1189 } while (bits != 0); |
| 1190 } | 1190 } |
| 1191 | 1191 |
| 1192 | 1192 |
| 1193 int32_t TranslationIterator::Next() { | 1193 int32_t TranslationIterator::Next() { |
| 1194 ASSERT(HasNext()); | |
| 1195 // Run through the bytes until we reach one with a least significant | 1194 // Run through the bytes until we reach one with a least significant |
| 1196 // bit of zero (marks the end). | 1195 // bit of zero (marks the end). |
| 1197 uint32_t bits = 0; | 1196 uint32_t bits = 0; |
| 1198 for (int i = 0; true; i += 7) { | 1197 for (int i = 0; true; i += 7) { |
| 1198 ASSERT(HasNext()); |
| 1199 uint8_t next = buffer_->get(index_++); | 1199 uint8_t next = buffer_->get(index_++); |
| 1200 bits |= (next >> 1) << i; | 1200 bits |= (next >> 1) << i; |
| 1201 if ((next & 1) == 0) break; | 1201 if ((next & 1) == 0) break; |
| 1202 } | 1202 } |
| 1203 // The bits encode the sign in the least significant bit. | 1203 // The bits encode the sign in the least significant bit. |
| 1204 bool is_negative = (bits & 1) == 1; | 1204 bool is_negative = (bits & 1) == 1; |
| 1205 int32_t result = bits >> 1; | 1205 int32_t result = bits >> 1; |
| 1206 return is_negative ? -result : result; | 1206 return is_negative ? -result : result; |
| 1207 } | 1207 } |
| 1208 | 1208 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 } | 1439 } |
| 1440 return; | 1440 return; |
| 1441 } | 1441 } |
| 1442 frames_to_skip--; | 1442 frames_to_skip--; |
| 1443 } | 1443 } |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 UNREACHABLE(); | 1446 UNREACHABLE(); |
| 1447 } | 1447 } |
| 1448 | 1448 |
| 1449 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1449 | 1450 |
| 1450 DeoptimizedFrameInfo::DeoptimizedFrameInfo( | 1451 DeoptimizedFrameInfo::DeoptimizedFrameInfo( |
| 1451 Deoptimizer* deoptimizer, int frame_index) { | 1452 Deoptimizer* deoptimizer, int frame_index) { |
| 1452 FrameDescription* output_frame = deoptimizer->output_[frame_index]; | 1453 FrameDescription* output_frame = deoptimizer->output_[frame_index]; |
| 1453 SetFunction(output_frame->GetFunction()); | 1454 SetFunction(output_frame->GetFunction()); |
| 1454 expression_count_ = output_frame->GetExpressionCount(deoptimizer); | 1455 expression_count_ = output_frame->GetExpressionCount(deoptimizer); |
| 1455 parameters_count_ = output_frame->ComputeParametersCount(); | 1456 parameters_count_ = output_frame->ComputeParametersCount(); |
| 1456 parameters_ = new Object*[parameters_count_]; | 1457 parameters_ = new Object*[parameters_count_]; |
| 1457 for (int i = 0; i < parameters_count_; i++) { | 1458 for (int i = 0; i < parameters_count_; i++) { |
| 1458 SetParameter(i, output_frame->GetParameter(deoptimizer, i)); | 1459 SetParameter(i, output_frame->GetParameter(deoptimizer, i)); |
| 1459 } | 1460 } |
| 1460 expression_stack_ = new Object*[expression_count_]; | 1461 expression_stack_ = new Object*[expression_count_]; |
| 1461 for (int i = 0; i < expression_count_; i++) { | 1462 for (int i = 0; i < expression_count_; i++) { |
| 1462 SetExpression(i, output_frame->GetExpression(deoptimizer, i)); | 1463 SetExpression(i, output_frame->GetExpression(deoptimizer, i)); |
| 1463 } | 1464 } |
| 1464 } | 1465 } |
| 1465 | 1466 |
| 1466 | 1467 |
| 1467 DeoptimizedFrameInfo::~DeoptimizedFrameInfo() { | 1468 DeoptimizedFrameInfo::~DeoptimizedFrameInfo() { |
| 1468 delete[] expression_stack_; | 1469 delete[] expression_stack_; |
| 1469 delete[] parameters_; | 1470 delete[] parameters_; |
| 1470 } | 1471 } |
| 1471 | 1472 |
| 1472 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 1473 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
| 1473 v->VisitPointer(BitCast<Object**>(&function_)); | 1474 v->VisitPointer(BitCast<Object**>(&function_)); |
| 1474 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 1475 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
| 1475 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 1476 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
| 1476 } | 1477 } |
| 1477 | 1478 |
| 1479 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1478 | 1480 |
| 1479 } } // namespace v8::internal | 1481 } } // namespace v8::internal |
| OLD | NEW |