| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 namespace v8 { | 38 namespace v8 { |
| 39 namespace internal { | 39 namespace internal { |
| 40 | 40 |
| 41 | 41 |
| 42 #ifdef ENABLE_DEBUGGER_SUPPORT | 42 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 43 | 43 |
| 44 static void CompileScriptForTracker(Handle<Script> script) { | 44 static void CompileScriptForTracker(Handle<Script> script) { |
| 45 const bool is_eval = false; | 45 const bool is_eval = false; |
| 46 const bool is_global = true; | 46 const bool is_global = true; |
| 47 // TODO: support extensions. | 47 // TODO(635): support extensions. |
| 48 Extension* extension = NULL; | 48 Extension* extension = NULL; |
| 49 | 49 |
| 50 PostponeInterruptsScope postpone; | 50 PostponeInterruptsScope postpone; |
| 51 | 51 |
| 52 // Only allow non-global compiles for eval. | 52 // Only allow non-global compiles for eval. |
| 53 ASSERT(is_eval || is_global); | 53 ASSERT(is_eval || is_global); |
| 54 | 54 |
| 55 // Build AST. | 55 // Build AST. |
| 56 ScriptDataImpl* pre_data = NULL; | 56 ScriptDataImpl* pre_data = NULL; |
| 57 FunctionLiteral* lit = MakeAST(is_global, script, extension, pre_data); | 57 FunctionLiteral* lit = MakeAST(is_global, script, extension, pre_data); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 // their contents and length. It is specified as array of groups of 3 numbers: | 378 // their contents and length. It is specified as array of groups of 3 numbers: |
| 379 // (change_begin, change_end, change_end_new_position). | 379 // (change_begin, change_end, change_end_new_position). |
| 380 // Each group describes a change in text; groups are sorted by change_begin. | 380 // Each group describes a change in text; groups are sorted by change_begin. |
| 381 // Only position in text beyond any changes may be successfully translated. | 381 // Only position in text beyond any changes may be successfully translated. |
| 382 // If a positions is inside some region that changed, result is currently | 382 // If a positions is inside some region that changed, result is currently |
| 383 // undefined. | 383 // undefined. |
| 384 static int TranslatePosition(int original_position, | 384 static int TranslatePosition(int original_position, |
| 385 Handle<JSArray> position_change_array) { | 385 Handle<JSArray> position_change_array) { |
| 386 int position_diff = 0; | 386 int position_diff = 0; |
| 387 int array_len = Smi::cast(position_change_array->length())->value(); | 387 int array_len = Smi::cast(position_change_array->length())->value(); |
| 388 // TODO: binary search may be used here | 388 // TODO(635): binary search may be used here |
| 389 for (int i = 0; i < array_len; i += 3) { | 389 for (int i = 0; i < array_len; i += 3) { |
| 390 int chunk_start = | 390 int chunk_start = |
| 391 Smi::cast(position_change_array->GetElement(i))->value(); | 391 Smi::cast(position_change_array->GetElement(i))->value(); |
| 392 int chunk_end = | 392 int chunk_end = |
| 393 Smi::cast(position_change_array->GetElement(i + 1))->value(); | 393 Smi::cast(position_change_array->GetElement(i + 1))->value(); |
| 394 int chunk_changed_end = | 394 int chunk_changed_end = |
| 395 Smi::cast(position_change_array->GetElement(i + 2))->value(); | 395 Smi::cast(position_change_array->GetElement(i + 2))->value(); |
| 396 position_diff = chunk_changed_end - chunk_end; | 396 position_diff = chunk_changed_end - chunk_end; |
| 397 if (original_position < chunk_start) { | 397 if (original_position < chunk_start) { |
| 398 break; | 398 break; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 474 |
| 475 bool LiveEditFunctionTracker::IsActive() { | 475 bool LiveEditFunctionTracker::IsActive() { |
| 476 return false; | 476 return false; |
| 477 } | 477 } |
| 478 | 478 |
| 479 #endif // ENABLE_DEBUGGER_SUPPORT | 479 #endif // ENABLE_DEBUGGER_SUPPORT |
| 480 | 480 |
| 481 | 481 |
| 482 | 482 |
| 483 } } // namespace v8::internal | 483 } } // namespace v8::internal |
| OLD | NEW |