OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 13400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13411 } else { | 13411 } else { |
13412 DCHECK(src_obj->IsString()); | 13412 DCHECK(src_obj->IsString()); |
13413 Handle<String> src(String::cast(src_obj), isolate); | 13413 Handle<String> src(String::cast(src_obj), isolate); |
13414 Handle<FixedArray> array = String::CalculateLineEnds(src, true); | 13414 Handle<FixedArray> array = String::CalculateLineEnds(src, true); |
13415 script->set_line_ends(*array); | 13415 script->set_line_ends(*array); |
13416 } | 13416 } |
13417 | 13417 |
13418 DCHECK(script->line_ends()->IsFixedArray()); | 13418 DCHECK(script->line_ends()->IsFixedArray()); |
13419 } | 13419 } |
13420 | 13420 |
| 13421 bool Script::GetPositionInfo(Handle<Script> script, int position, |
| 13422 PositionInfo* info, OffsetFlag offset_flag) { |
| 13423 InitLineEnds(script); |
| 13424 return script->GetPositionInfo(position, info, offset_flag); |
| 13425 } |
| 13426 |
| 13427 namespace { |
| 13428 bool GetPositionInfoSlow(const Script* script, int position, |
| 13429 Script::PositionInfo* info) { |
| 13430 if (!script->source()->IsString()) return false; |
| 13431 if (position < 0) position = 0; |
| 13432 |
| 13433 String* source_string = String::cast(script->source()); |
| 13434 int line = 0; |
| 13435 int line_start = 0; |
| 13436 int len = source_string->length(); |
| 13437 for (int pos = 0; pos <= len; ++pos) { |
| 13438 if (pos == len || source_string->Get(pos) == '\n') { |
| 13439 if (position <= pos) { |
| 13440 info->line = line; |
| 13441 info->column = position - line_start; |
| 13442 info->line_start = line_start; |
| 13443 info->line_end = pos; |
| 13444 return true; |
| 13445 } |
| 13446 line++; |
| 13447 line_start = pos + 1; |
| 13448 } |
| 13449 } |
| 13450 return false; |
| 13451 } |
| 13452 } // namespace |
| 13453 |
13421 #define SMI_VALUE(x) (Smi::cast(x)->value()) | 13454 #define SMI_VALUE(x) (Smi::cast(x)->value()) |
13422 bool Script::GetPositionInfo(int position, PositionInfo* info, | 13455 bool Script::GetPositionInfo(int position, PositionInfo* info, |
13423 OffsetFlag offset_flag) { | 13456 OffsetFlag offset_flag) const { |
13424 Handle<Script> script(this); | |
13425 InitLineEnds(script); | |
13426 | |
13427 DisallowHeapAllocation no_allocation; | 13457 DisallowHeapAllocation no_allocation; |
13428 | 13458 |
13429 DCHECK(script->line_ends()->IsFixedArray()); | 13459 if (line_ends()->IsUndefined(GetIsolate())) { |
13430 FixedArray* ends = FixedArray::cast(script->line_ends()); | 13460 // Slow mode: we do not have line_ends. We have to iterate through source. |
| 13461 if (!GetPositionInfoSlow(this, position, info)) return false; |
| 13462 } else { |
| 13463 DCHECK(line_ends()->IsFixedArray()); |
| 13464 FixedArray* ends = FixedArray::cast(line_ends()); |
13431 | 13465 |
13432 const int ends_len = ends->length(); | 13466 const int ends_len = ends->length(); |
13433 if (ends_len == 0) return false; | 13467 if (ends_len == 0) return false; |
13434 | 13468 |
13435 // Return early on invalid positions. Negative positions behave as if 0 was | 13469 // Return early on invalid positions. Negative positions behave as if 0 was |
13436 // passed, and positions beyond the end of the script return as failure. | 13470 // passed, and positions beyond the end of the script return as failure. |
13437 if (position < 0) { | 13471 if (position < 0) { |
13438 position = 0; | 13472 position = 0; |
13439 } else if (position > SMI_VALUE(ends->get(ends_len - 1))) { | 13473 } else if (position > SMI_VALUE(ends->get(ends_len - 1))) { |
13440 return false; | 13474 return false; |
13441 } | 13475 } |
13442 | 13476 |
13443 // Determine line number by doing a binary search on the line ends array. | 13477 // Determine line number by doing a binary search on the line ends array. |
13444 if (SMI_VALUE(ends->get(0)) >= position) { | 13478 if (SMI_VALUE(ends->get(0)) >= position) { |
13445 info->line = 0; | 13479 info->line = 0; |
13446 info->line_start = 0; | 13480 info->line_start = 0; |
13447 info->column = position; | 13481 info->column = position; |
13448 } else { | 13482 } else { |
13449 int left = 0; | 13483 int left = 0; |
13450 int right = ends_len - 1; | 13484 int right = ends_len - 1; |
13451 | 13485 |
13452 while (right > 0) { | 13486 while (right > 0) { |
13453 DCHECK_LE(left, right); | 13487 DCHECK_LE(left, right); |
13454 const int mid = (left + right) / 2; | 13488 const int mid = (left + right) / 2; |
13455 if (position > SMI_VALUE(ends->get(mid))) { | 13489 if (position > SMI_VALUE(ends->get(mid))) { |
13456 left = mid + 1; | 13490 left = mid + 1; |
13457 } else if (position <= SMI_VALUE(ends->get(mid - 1))) { | 13491 } else if (position <= SMI_VALUE(ends->get(mid - 1))) { |
13458 right = mid - 1; | 13492 right = mid - 1; |
13459 } else { | 13493 } else { |
13460 info->line = mid; | 13494 info->line = mid; |
13461 break; | 13495 break; |
| 13496 } |
13462 } | 13497 } |
| 13498 DCHECK(SMI_VALUE(ends->get(info->line)) >= position && |
| 13499 SMI_VALUE(ends->get(info->line - 1)) < position); |
| 13500 info->line_start = SMI_VALUE(ends->get(info->line - 1)) + 1; |
| 13501 info->column = position - info->line_start; |
13463 } | 13502 } |
13464 DCHECK(SMI_VALUE(ends->get(info->line)) >= position && | |
13465 SMI_VALUE(ends->get(info->line - 1)) < position); | |
13466 info->line_start = SMI_VALUE(ends->get(info->line - 1)) + 1; | |
13467 info->column = position - info->line_start; | |
13468 } | |
13469 | 13503 |
13470 // Line end is position of the linebreak character. | 13504 // Line end is position of the linebreak character. |
13471 info->line_end = SMI_VALUE(ends->get(info->line)); | 13505 info->line_end = SMI_VALUE(ends->get(info->line)); |
13472 if (info->line_end > 0) { | 13506 if (info->line_end > 0) { |
13473 DCHECK(script->source()->IsString()); | 13507 DCHECK(source()->IsString()); |
13474 Handle<String> src(String::cast(script->source())); | 13508 String* src = String::cast(source()); |
13475 if (src->length() >= info->line_end && | 13509 if (src->length() >= info->line_end && |
13476 src->Get(info->line_end - 1) == '\r') { | 13510 src->Get(info->line_end - 1) == '\r') { |
13477 info->line_end--; | 13511 info->line_end--; |
| 13512 } |
13478 } | 13513 } |
13479 } | 13514 } |
13480 | 13515 |
13481 // Add offsets if requested. | 13516 // Add offsets if requested. |
13482 if (offset_flag == WITH_OFFSET) { | 13517 if (offset_flag == WITH_OFFSET) { |
13483 if (info->line == 0) { | 13518 if (info->line == 0) { |
13484 info->column += script->column_offset(); | 13519 info->column += column_offset(); |
13485 } | 13520 } |
13486 info->line += script->line_offset(); | 13521 info->line += line_offset(); |
13487 } | 13522 } |
13488 | 13523 |
13489 return true; | 13524 return true; |
13490 } | 13525 } |
13491 #undef SMI_VALUE | 13526 #undef SMI_VALUE |
13492 | 13527 |
13493 int Script::GetColumnNumber(Handle<Script> script, int code_pos) { | 13528 int Script::GetColumnNumber(Handle<Script> script, int code_pos) { |
13494 PositionInfo info; | 13529 PositionInfo info; |
13495 if (!script->GetPositionInfo(code_pos, &info, WITH_OFFSET)) { | 13530 GetPositionInfo(script, code_pos, &info, WITH_OFFSET); |
13496 return -1; | |
13497 } | |
13498 | |
13499 return info.column; | 13531 return info.column; |
13500 } | 13532 } |
13501 | 13533 |
13502 int Script::GetLineNumberWithArray(int code_pos) { | 13534 int Script::GetColumnNumber(int code_pos) const { |
13503 PositionInfo info; | 13535 PositionInfo info; |
13504 if (!GetPositionInfo(code_pos, &info, WITH_OFFSET)) { | 13536 GetPositionInfo(code_pos, &info, WITH_OFFSET); |
13505 return -1; | 13537 return info.column; |
13506 } | 13538 } |
13507 | 13539 |
| 13540 int Script::GetLineNumber(Handle<Script> script, int code_pos) { |
| 13541 PositionInfo info; |
| 13542 GetPositionInfo(script, code_pos, &info, WITH_OFFSET); |
13508 return info.line; | 13543 return info.line; |
13509 } | 13544 } |
13510 | 13545 |
13511 | 13546 int Script::GetLineNumber(int code_pos) const { |
13512 int Script::GetLineNumber(Handle<Script> script, int code_pos) { | 13547 PositionInfo info; |
13513 InitLineEnds(script); | 13548 GetPositionInfo(code_pos, &info, WITH_OFFSET); |
13514 return script->GetLineNumberWithArray(code_pos); | 13549 return info.line; |
13515 } | 13550 } |
13516 | 13551 |
13517 | |
13518 int Script::GetLineNumber(int code_pos) { | |
13519 DisallowHeapAllocation no_allocation; | |
13520 if (!line_ends()->IsUndefined(GetIsolate())) { | |
13521 return GetLineNumberWithArray(code_pos); | |
13522 } | |
13523 | |
13524 // Slow mode: we do not have line_ends. We have to iterate through source. | |
13525 if (!source()->IsString()) return -1; | |
13526 | |
13527 String* source_string = String::cast(source()); | |
13528 int line = 0; | |
13529 int len = source_string->length(); | |
13530 for (int pos = 0; pos < len; pos++) { | |
13531 if (pos == code_pos) break; | |
13532 if (source_string->Get(pos) == '\n') line++; | |
13533 } | |
13534 return line; | |
13535 } | |
13536 | |
13537 | |
13538 Handle<Object> Script::GetNameOrSourceURL(Handle<Script> script) { | 13552 Handle<Object> Script::GetNameOrSourceURL(Handle<Script> script) { |
13539 Isolate* isolate = script->GetIsolate(); | 13553 Isolate* isolate = script->GetIsolate(); |
13540 | 13554 |
13541 // Keep in sync with ScriptNameOrSourceURL in messages.js. | 13555 // Keep in sync with ScriptNameOrSourceURL in messages.js. |
13542 | 13556 |
13543 if (!script->source_url()->IsUndefined(isolate)) { | 13557 if (!script->source_url()->IsUndefined(isolate)) { |
13544 return handle(script->source_url(), isolate); | 13558 return handle(script->source_url(), isolate); |
13545 } | 13559 } |
13546 return handle(script->name(), isolate); | 13560 return handle(script->name(), isolate); |
13547 } | 13561 } |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14283 } | 14297 } |
14284 } | 14298 } |
14285 | 14299 |
14286 int AbstractCode::SourcePosition(int offset) { | 14300 int AbstractCode::SourcePosition(int offset) { |
14287 int position = 0; | 14301 int position = 0; |
14288 // Subtract one because the current PC is one instruction after the call site. | 14302 // Subtract one because the current PC is one instruction after the call site. |
14289 if (IsCode()) offset--; | 14303 if (IsCode()) offset--; |
14290 for (SourcePositionTableIterator iterator(source_position_table()); | 14304 for (SourcePositionTableIterator iterator(source_position_table()); |
14291 !iterator.done() && iterator.code_offset() <= offset; | 14305 !iterator.done() && iterator.code_offset() <= offset; |
14292 iterator.Advance()) { | 14306 iterator.Advance()) { |
14293 position = iterator.source_position(); | 14307 position = iterator.source_position().ScriptOffset(); |
14294 } | 14308 } |
14295 return position; | 14309 return position; |
14296 } | 14310 } |
14297 | 14311 |
14298 int AbstractCode::SourceStatementPosition(int offset) { | 14312 int AbstractCode::SourceStatementPosition(int offset) { |
14299 // First find the closest position. | 14313 // First find the closest position. |
14300 int position = SourcePosition(offset); | 14314 int position = SourcePosition(offset); |
14301 // Now find the closest statement position before the position. | 14315 // Now find the closest statement position before the position. |
14302 int statement_position = 0; | 14316 int statement_position = 0; |
14303 for (SourcePositionTableIterator it(source_position_table()); !it.done(); | 14317 for (SourcePositionTableIterator it(source_position_table()); !it.done(); |
14304 it.Advance()) { | 14318 it.Advance()) { |
14305 if (it.is_statement()) { | 14319 if (it.is_statement()) { |
14306 int p = it.source_position(); | 14320 int p = it.source_position().ScriptOffset(); |
14307 if (statement_position < p && p <= position) { | 14321 if (statement_position < p && p <= position) { |
14308 statement_position = p; | 14322 statement_position = p; |
14309 } | 14323 } |
14310 } | 14324 } |
14311 } | 14325 } |
14312 return statement_position; | 14326 return statement_position; |
14313 } | 14327 } |
14314 | 14328 |
14315 void JSFunction::ClearTypeFeedbackInfo() { | 14329 void JSFunction::ClearTypeFeedbackInfo() { |
14316 feedback_vector()->ClearSlots(shared()); | 14330 feedback_vector()->ClearSlots(shared()); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14514 UNREACHABLE(); | 14528 UNREACHABLE(); |
14515 break; | 14529 break; |
14516 } | 14530 } |
14517 return NULL; | 14531 return NULL; |
14518 } | 14532 } |
14519 | 14533 |
14520 | 14534 |
14521 void Code::PrintDeoptLocation(FILE* out, Address pc) { | 14535 void Code::PrintDeoptLocation(FILE* out, Address pc) { |
14522 Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(this, pc); | 14536 Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(this, pc); |
14523 class SourcePosition pos = info.position; | 14537 class SourcePosition pos = info.position; |
14524 if (info.deopt_reason != DeoptimizeReason::kNoReason || !pos.IsUnknown()) { | 14538 if (info.deopt_reason != DeoptimizeReason::kNoReason || pos.IsKnown()) { |
14525 if (FLAG_hydrogen_track_positions) { | 14539 if (FLAG_hydrogen_track_positions) { |
14526 PrintF(out, " ;;; deoptimize at %d_%d: %s\n", | 14540 PrintF(out, " ;;; deoptimize at %d_%d: %s\n", pos.InliningId(), |
14527 pos.inlining_id(), pos.position(), | 14541 pos.ScriptOffset(), DeoptimizeReasonToString(info.deopt_reason)); |
14528 DeoptimizeReasonToString(info.deopt_reason)); | |
14529 } else { | 14542 } else { |
14530 PrintF(out, " ;;; deoptimize at %d: %s\n", pos.raw(), | 14543 PrintF(out, " ;;; deoptimize at "); |
14531 DeoptimizeReasonToString(info.deopt_reason)); | 14544 OFStream outstr(out); |
| 14545 pos.Print(outstr, this); |
| 14546 PrintF(out, ", %s\n", DeoptimizeReasonToString(info.deopt_reason)); |
14532 } | 14547 } |
14533 } | 14548 } |
14534 } | 14549 } |
14535 | 14550 |
14536 | 14551 |
14537 bool Code::CanDeoptAt(Address pc) { | 14552 bool Code::CanDeoptAt(Address pc) { |
14538 DeoptimizationInputData* deopt_data = | 14553 DeoptimizationInputData* deopt_data = |
14539 DeoptimizationInputData::cast(deoptimization_data()); | 14554 DeoptimizationInputData::cast(deoptimization_data()); |
14540 Address code_start_address = instruction_start(); | 14555 Address code_start_address = instruction_start(); |
14541 for (int i = 0; i < deopt_data->DeoptCount(); i++) { | 14556 for (int i = 0; i < deopt_data->DeoptCount(); i++) { |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14960 } | 14975 } |
14961 } | 14976 } |
14962 } | 14977 } |
14963 os << "\n"; | 14978 os << "\n"; |
14964 | 14979 |
14965 SourcePositionTableIterator it(source_position_table()); | 14980 SourcePositionTableIterator it(source_position_table()); |
14966 if (!it.done()) { | 14981 if (!it.done()) { |
14967 os << "Source positions:\n pc offset position\n"; | 14982 os << "Source positions:\n pc offset position\n"; |
14968 for (; !it.done(); it.Advance()) { | 14983 for (; !it.done(); it.Advance()) { |
14969 os << std::setw(10) << it.code_offset() << std::setw(10) | 14984 os << std::setw(10) << it.code_offset() << std::setw(10) |
14970 << it.source_position() << (it.is_statement() ? " statement" : "") | 14985 << it.source_position().ScriptOffset() |
14971 << "\n"; | 14986 << (it.is_statement() ? " statement" : "") << "\n"; |
14972 } | 14987 } |
14973 os << "\n"; | 14988 os << "\n"; |
14974 } | 14989 } |
14975 | 14990 |
14976 if (kind() == FUNCTION) { | 14991 if (kind() == FUNCTION) { |
14977 DeoptimizationOutputData* data = | 14992 DeoptimizationOutputData* data = |
14978 DeoptimizationOutputData::cast(this->deoptimization_data()); | 14993 DeoptimizationOutputData::cast(this->deoptimization_data()); |
14979 data->DeoptimizationOutputDataPrint(os); | 14994 data->DeoptimizationOutputDataPrint(os); |
14980 } else if (kind() == OPTIMIZED_FUNCTION) { | 14995 } else if (kind() == OPTIMIZED_FUNCTION) { |
14981 DeoptimizationInputData* data = | 14996 DeoptimizationInputData* data = |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15063 os << "Parameter count " << parameter_count() << "\n"; | 15078 os << "Parameter count " << parameter_count() << "\n"; |
15064 os << "Frame size " << frame_size() << "\n"; | 15079 os << "Frame size " << frame_size() << "\n"; |
15065 | 15080 |
15066 const uint8_t* base_address = GetFirstBytecodeAddress(); | 15081 const uint8_t* base_address = GetFirstBytecodeAddress(); |
15067 SourcePositionTableIterator source_positions(source_position_table()); | 15082 SourcePositionTableIterator source_positions(source_position_table()); |
15068 | 15083 |
15069 interpreter::BytecodeArrayIterator iterator(handle(this)); | 15084 interpreter::BytecodeArrayIterator iterator(handle(this)); |
15070 while (!iterator.done()) { | 15085 while (!iterator.done()) { |
15071 if (!source_positions.done() && | 15086 if (!source_positions.done() && |
15072 iterator.current_offset() == source_positions.code_offset()) { | 15087 iterator.current_offset() == source_positions.code_offset()) { |
15073 os << std::setw(5) << source_positions.source_position(); | 15088 os << std::setw(5) << source_positions.source_position().ScriptOffset(); |
15074 os << (source_positions.is_statement() ? " S> " : " E> "); | 15089 os << (source_positions.is_statement() ? " S> " : " E> "); |
15075 source_positions.Advance(); | 15090 source_positions.Advance(); |
15076 } else { | 15091 } else { |
15077 os << " "; | 15092 os << " "; |
15078 } | 15093 } |
15079 const uint8_t* current_address = base_address + iterator.current_offset(); | 15094 const uint8_t* current_address = base_address + iterator.current_offset(); |
15080 os << reinterpret_cast<const void*>(current_address) << " @ " | 15095 os << reinterpret_cast<const void*>(current_address) << " @ " |
15081 << std::setw(4) << iterator.current_offset() << " : "; | 15096 << std::setw(4) << iterator.current_offset() << " : "; |
15082 interpreter::BytecodeDecoder::Decode(os, current_address, | 15097 interpreter::BytecodeDecoder::Decode(os, current_address, |
15083 parameter_count()); | 15098 parameter_count()); |
(...skipping 4320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19404 | 19419 |
19405 } // namespace | 19420 } // namespace |
19406 | 19421 |
19407 int JSMessageObject::GetLineNumber() const { | 19422 int JSMessageObject::GetLineNumber() const { |
19408 if (start_position() == -1) return Message::kNoLineNumberInfo; | 19423 if (start_position() == -1) return Message::kNoLineNumberInfo; |
19409 | 19424 |
19410 Handle<Script> the_script = handle(ScriptFromJSValue(script())); | 19425 Handle<Script> the_script = handle(ScriptFromJSValue(script())); |
19411 | 19426 |
19412 Script::PositionInfo info; | 19427 Script::PositionInfo info; |
19413 const Script::OffsetFlag offset_flag = Script::WITH_OFFSET; | 19428 const Script::OffsetFlag offset_flag = Script::WITH_OFFSET; |
19414 if (!the_script->GetPositionInfo(start_position(), &info, offset_flag)) { | 19429 if (!Script::GetPositionInfo(the_script, start_position(), &info, |
| 19430 offset_flag)) { |
19415 return Message::kNoLineNumberInfo; | 19431 return Message::kNoLineNumberInfo; |
19416 } | 19432 } |
19417 | 19433 |
19418 return info.line + 1; | 19434 return info.line + 1; |
19419 } | 19435 } |
19420 | 19436 |
19421 int JSMessageObject::GetColumnNumber() const { | 19437 int JSMessageObject::GetColumnNumber() const { |
19422 if (start_position() == -1) return -1; | 19438 if (start_position() == -1) return -1; |
19423 | 19439 |
19424 Handle<Script> the_script = handle(ScriptFromJSValue(script())); | 19440 Handle<Script> the_script = handle(ScriptFromJSValue(script())); |
19425 | 19441 |
19426 Script::PositionInfo info; | 19442 Script::PositionInfo info; |
19427 const Script::OffsetFlag offset_flag = Script::WITH_OFFSET; | 19443 const Script::OffsetFlag offset_flag = Script::WITH_OFFSET; |
19428 if (!the_script->GetPositionInfo(start_position(), &info, offset_flag)) { | 19444 if (!Script::GetPositionInfo(the_script, start_position(), &info, |
| 19445 offset_flag)) { |
19429 return -1; | 19446 return -1; |
19430 } | 19447 } |
19431 | 19448 |
19432 return info.column; // Note: No '+1' in contrast to GetLineNumber. | 19449 return info.column; // Note: No '+1' in contrast to GetLineNumber. |
19433 } | 19450 } |
19434 | 19451 |
19435 Handle<String> JSMessageObject::GetSourceLine() const { | 19452 Handle<String> JSMessageObject::GetSourceLine() const { |
19436 Handle<Script> the_script = handle(ScriptFromJSValue(script())); | 19453 Handle<Script> the_script = handle(ScriptFromJSValue(script())); |
19437 | 19454 |
19438 Isolate* isolate = the_script->GetIsolate(); | 19455 Isolate* isolate = the_script->GetIsolate(); |
19439 if (the_script->type() == Script::TYPE_WASM) { | 19456 if (the_script->type() == Script::TYPE_WASM) { |
19440 return isolate->factory()->empty_string(); | 19457 return isolate->factory()->empty_string(); |
19441 } | 19458 } |
19442 | 19459 |
19443 Script::PositionInfo info; | 19460 Script::PositionInfo info; |
19444 const Script::OffsetFlag offset_flag = Script::WITH_OFFSET; | 19461 const Script::OffsetFlag offset_flag = Script::WITH_OFFSET; |
19445 if (!the_script->GetPositionInfo(start_position(), &info, offset_flag)) { | 19462 if (!Script::GetPositionInfo(the_script, start_position(), &info, |
| 19463 offset_flag)) { |
19446 return isolate->factory()->empty_string(); | 19464 return isolate->factory()->empty_string(); |
19447 } | 19465 } |
19448 | 19466 |
19449 Handle<String> src = handle(String::cast(the_script->source()), isolate); | 19467 Handle<String> src = handle(String::cast(the_script->source()), isolate); |
19450 return isolate->factory()->NewSubString(src, info.line_start, info.line_end); | 19468 return isolate->factory()->NewSubString(src, info.line_start, info.line_end); |
19451 } | 19469 } |
19452 | 19470 |
19453 void JSArrayBuffer::Neuter() { | 19471 void JSArrayBuffer::Neuter() { |
19454 CHECK(is_neuterable()); | 19472 CHECK(is_neuterable()); |
19455 CHECK(is_external()); | 19473 CHECK(is_external()); |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20340 // Check if the accessor uses a cached property. | 20358 // Check if the accessor uses a cached property. |
20341 if (!fti->cached_property_name()->IsTheHole(isolate)) { | 20359 if (!fti->cached_property_name()->IsTheHole(isolate)) { |
20342 return handle(Name::cast(fti->cached_property_name())); | 20360 return handle(Name::cast(fti->cached_property_name())); |
20343 } | 20361 } |
20344 } | 20362 } |
20345 return MaybeHandle<Name>(); | 20363 return MaybeHandle<Name>(); |
20346 } | 20364 } |
20347 | 20365 |
20348 } // namespace internal | 20366 } // namespace internal |
20349 } // namespace v8 | 20367 } // namespace v8 |
OLD | NEW |