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 13372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13383 Handle<FixedArray> array = String::CalculateLineEnds(src, true); | 13383 Handle<FixedArray> array = String::CalculateLineEnds(src, true); |
13384 | 13384 |
13385 if (*array != isolate->heap()->empty_fixed_array()) { | 13385 if (*array != isolate->heap()->empty_fixed_array()) { |
13386 array->set_map(isolate->heap()->fixed_cow_array_map()); | 13386 array->set_map(isolate->heap()->fixed_cow_array_map()); |
13387 } | 13387 } |
13388 | 13388 |
13389 script->set_line_ends(*array); | 13389 script->set_line_ends(*array); |
13390 DCHECK(script->line_ends()->IsFixedArray()); | 13390 DCHECK(script->line_ends()->IsFixedArray()); |
13391 } | 13391 } |
13392 | 13392 |
13393 bool Script::GetPositionInfo(Handle<Script> script, int position, | |
13394 PositionInfo* info, OffsetFlag offset_flag) { | |
13395 InitLineEnds(script); | |
13396 return script->GetPositionInfo(position, info, offset_flag); | |
13397 } | |
13398 | |
13399 namespace { | |
13400 bool GetPositionInfoSlow(Script* script, int position, | |
13401 Script::PositionInfo* info) { | |
13402 if (!script->source()->IsString()) return false; | |
13403 if (position < 0) position = 0; | |
13404 | |
13405 String* source_string = String::cast(script->source()); | |
13406 int line = 0; | |
13407 int line_start = 0; | |
13408 int len = source_string->length(); | |
13409 for (int pos = 0; pos <= len; ++pos) { | |
13410 if (pos == len || source_string->Get(pos) == '\n') { | |
13411 if (position <= pos) { | |
13412 info->line = line; | |
13413 info->column = position - line_start; | |
13414 info->line_start = line_start; | |
13415 info->line_end = pos; | |
13416 return true; | |
13417 } | |
13418 line++; | |
13419 line_start = pos + 1; | |
13420 } | |
13421 } | |
13422 return false; | |
13423 } | |
13424 } // namespace | |
13425 | |
13393 #define SMI_VALUE(x) (Smi::cast(x)->value()) | 13426 #define SMI_VALUE(x) (Smi::cast(x)->value()) |
13394 bool Script::GetPositionInfo(int position, PositionInfo* info, | 13427 bool Script::GetPositionInfo(int position, PositionInfo* info, |
13395 OffsetFlag offset_flag) { | 13428 OffsetFlag offset_flag) { |
13396 Handle<Script> script(this); | |
13397 InitLineEnds(script); | |
13398 | |
13399 DisallowHeapAllocation no_allocation; | 13429 DisallowHeapAllocation no_allocation; |
13400 | 13430 |
13401 DCHECK(script->line_ends()->IsFixedArray()); | 13431 if (line_ends()->IsUndefined(GetIsolate())) { |
13402 FixedArray* ends = FixedArray::cast(script->line_ends()); | 13432 // Slow mode: we do not have line_ends. We have to iterate through source. |
13433 if (!GetPositionInfoSlow(this, position, info)) return false; | |
alph
2016/11/07 22:38:39
Why the change? It's gonna be slow on repetitive c
Tobias Tebbi
2016/11/08 10:29:07
Yes, because this is the safe unhandlified version
Yang
2016/11/08 13:32:13
Yes, but assuming that we migrate to the handlifie
| |
13434 } else { | |
13435 DCHECK(line_ends()->IsFixedArray()); | |
13436 FixedArray* ends = FixedArray::cast(line_ends()); | |
13403 | 13437 |
13404 const int ends_len = ends->length(); | 13438 const int ends_len = ends->length(); |
13405 if (ends_len == 0) return false; | 13439 if (ends_len == 0) return false; |
13406 | 13440 |
13407 // Return early on invalid positions. Negative positions behave as if 0 was | 13441 // Return early on invalid positions. Negative positions behave as if 0 was |
13408 // passed, and positions beyond the end of the script return as failure. | 13442 // passed, and positions beyond the end of the script return as failure. |
13409 if (position < 0) { | 13443 if (position < 0) { |
13410 position = 0; | 13444 position = 0; |
13411 } else if (position > SMI_VALUE(ends->get(ends_len - 1))) { | 13445 } else if (position > SMI_VALUE(ends->get(ends_len - 1))) { |
13412 return false; | 13446 return false; |
13413 } | 13447 } |
13414 | 13448 |
13415 // Determine line number by doing a binary search on the line ends array. | 13449 // Determine line number by doing a binary search on the line ends array. |
13416 if (SMI_VALUE(ends->get(0)) >= position) { | 13450 if (SMI_VALUE(ends->get(0)) >= position) { |
13417 info->line = 0; | 13451 info->line = 0; |
13418 info->line_start = 0; | 13452 info->line_start = 0; |
13419 info->column = position; | 13453 info->column = position; |
13420 } else { | 13454 } else { |
13421 int left = 0; | 13455 int left = 0; |
13422 int right = ends_len - 1; | 13456 int right = ends_len - 1; |
13423 | 13457 |
13424 while (right > 0) { | 13458 while (right > 0) { |
13425 DCHECK_LE(left, right); | 13459 DCHECK_LE(left, right); |
13426 const int mid = (left + right) / 2; | 13460 const int mid = (left + right) / 2; |
13427 if (position > SMI_VALUE(ends->get(mid))) { | 13461 if (position > SMI_VALUE(ends->get(mid))) { |
13428 left = mid + 1; | 13462 left = mid + 1; |
13429 } else if (position <= SMI_VALUE(ends->get(mid - 1))) { | 13463 } else if (position <= SMI_VALUE(ends->get(mid - 1))) { |
13430 right = mid - 1; | 13464 right = mid - 1; |
13431 } else { | 13465 } else { |
13432 info->line = mid; | 13466 info->line = mid; |
13433 break; | 13467 break; |
13468 } | |
13434 } | 13469 } |
13470 DCHECK(SMI_VALUE(ends->get(info->line)) >= position && | |
13471 SMI_VALUE(ends->get(info->line - 1)) < position); | |
13472 info->line_start = SMI_VALUE(ends->get(info->line - 1)) + 1; | |
13473 info->column = position - info->line_start; | |
13435 } | 13474 } |
13436 DCHECK(SMI_VALUE(ends->get(info->line)) >= position && | |
13437 SMI_VALUE(ends->get(info->line - 1)) < position); | |
13438 info->line_start = SMI_VALUE(ends->get(info->line - 1)) + 1; | |
13439 info->column = position - info->line_start; | |
13440 } | |
13441 | 13475 |
13442 // Line end is position of the linebreak character. | 13476 // Line end is position of the linebreak character. |
13443 info->line_end = SMI_VALUE(ends->get(info->line)); | 13477 info->line_end = SMI_VALUE(ends->get(info->line)); |
13444 if (info->line_end > 0) { | 13478 if (info->line_end > 0) { |
13445 DCHECK(script->source()->IsString()); | 13479 DCHECK(source()->IsString()); |
13446 Handle<String> src(String::cast(script->source())); | 13480 String* src = String::cast(source()); |
13447 if (src->length() >= info->line_end && | 13481 if (src->length() >= info->line_end && |
13448 src->Get(info->line_end - 1) == '\r') { | 13482 src->Get(info->line_end - 1) == '\r') { |
13449 info->line_end--; | 13483 info->line_end--; |
13484 } | |
13450 } | 13485 } |
13451 } | 13486 } |
13452 | 13487 |
13453 // Add offsets if requested. | 13488 // Add offsets if requested. |
13454 if (offset_flag == WITH_OFFSET) { | 13489 if (offset_flag == WITH_OFFSET) { |
13455 if (info->line == 0) { | 13490 if (info->line == 0) { |
13456 info->column += script->column_offset(); | 13491 info->column += column_offset(); |
13457 } | 13492 } |
13458 info->line += script->line_offset(); | 13493 info->line += line_offset(); |
13459 } | 13494 } |
13460 | 13495 |
13461 return true; | 13496 return true; |
13462 } | 13497 } |
13463 #undef SMI_VALUE | 13498 #undef SMI_VALUE |
13464 | 13499 |
13465 int Script::GetColumnNumber(Handle<Script> script, int code_pos) { | 13500 int Script::GetColumnNumber(Handle<Script> script, int code_pos) { |
13466 PositionInfo info; | 13501 PositionInfo info; |
13467 if (!script->GetPositionInfo(code_pos, &info, WITH_OFFSET)) { | 13502 Script::GetPositionInfo(script, code_pos, &info, WITH_OFFSET); |
Yang
2016/11/08 13:32:13
The "Script::" is redundant here. Same below.
| |
13468 return -1; | |
13469 } | |
13470 | |
13471 return info.column; | 13503 return info.column; |
13472 } | 13504 } |
13473 | 13505 |
13474 int Script::GetLineNumberWithArray(int code_pos) { | 13506 int Script::GetColumnNumber(int code_pos) { |
13475 PositionInfo info; | 13507 PositionInfo info; |
13476 if (!GetPositionInfo(code_pos, &info, WITH_OFFSET)) { | 13508 GetPositionInfo(code_pos, &info, WITH_OFFSET); |
13477 return -1; | 13509 return info.column; |
13478 } | 13510 } |
13479 | 13511 |
13512 int Script::GetLineNumber(Handle<Script> script, int code_pos) { | |
13513 PositionInfo info; | |
13514 Script::GetPositionInfo(script, code_pos, &info, WITH_OFFSET); | |
13480 return info.line; | 13515 return info.line; |
13481 } | 13516 } |
13482 | 13517 |
13483 | 13518 int Script::GetLineNumber(int code_pos) { |
13484 int Script::GetLineNumber(Handle<Script> script, int code_pos) { | 13519 PositionInfo info; |
13485 InitLineEnds(script); | 13520 GetPositionInfo(code_pos, &info, WITH_OFFSET); |
13486 return script->GetLineNumberWithArray(code_pos); | 13521 return info.line; |
13487 } | 13522 } |
13488 | 13523 |
13489 | |
13490 int Script::GetLineNumber(int code_pos) { | |
13491 DisallowHeapAllocation no_allocation; | |
13492 if (!line_ends()->IsUndefined(GetIsolate())) { | |
13493 return GetLineNumberWithArray(code_pos); | |
13494 } | |
13495 | |
13496 // Slow mode: we do not have line_ends. We have to iterate through source. | |
13497 if (!source()->IsString()) return -1; | |
13498 | |
13499 String* source_string = String::cast(source()); | |
13500 int line = 0; | |
13501 int len = source_string->length(); | |
13502 for (int pos = 0; pos < len; pos++) { | |
13503 if (pos == code_pos) break; | |
13504 if (source_string->Get(pos) == '\n') line++; | |
13505 } | |
13506 return line; | |
13507 } | |
13508 | |
13509 | |
13510 Handle<Object> Script::GetNameOrSourceURL(Handle<Script> script) { | 13524 Handle<Object> Script::GetNameOrSourceURL(Handle<Script> script) { |
13511 Isolate* isolate = script->GetIsolate(); | 13525 Isolate* isolate = script->GetIsolate(); |
13512 | 13526 |
13513 // Keep in sync with ScriptNameOrSourceURL in messages.js. | 13527 // Keep in sync with ScriptNameOrSourceURL in messages.js. |
13514 | 13528 |
13515 if (!script->source_url()->IsUndefined(isolate)) { | 13529 if (!script->source_url()->IsUndefined(isolate)) { |
13516 return handle(script->source_url(), isolate); | 13530 return handle(script->source_url(), isolate); |
13517 } | 13531 } |
13518 return handle(script->name(), isolate); | 13532 return handle(script->name(), isolate); |
13519 } | 13533 } |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
14255 } | 14269 } |
14256 } | 14270 } |
14257 | 14271 |
14258 int AbstractCode::SourcePosition(int offset) { | 14272 int AbstractCode::SourcePosition(int offset) { |
14259 int position = 0; | 14273 int position = 0; |
14260 // Subtract one because the current PC is one instruction after the call site. | 14274 // Subtract one because the current PC is one instruction after the call site. |
14261 if (IsCode()) offset--; | 14275 if (IsCode()) offset--; |
14262 for (SourcePositionTableIterator iterator(source_position_table()); | 14276 for (SourcePositionTableIterator iterator(source_position_table()); |
14263 !iterator.done() && iterator.code_offset() <= offset; | 14277 !iterator.done() && iterator.code_offset() <= offset; |
14264 iterator.Advance()) { | 14278 iterator.Advance()) { |
14265 position = iterator.source_position(); | 14279 position = iterator.source_position().ScriptOffset(); |
14266 } | 14280 } |
14267 return position; | 14281 return position; |
14268 } | 14282 } |
14269 | 14283 |
14270 int AbstractCode::SourceStatementPosition(int offset) { | 14284 int AbstractCode::SourceStatementPosition(int offset) { |
14271 // First find the closest position. | 14285 // First find the closest position. |
14272 int position = SourcePosition(offset); | 14286 int position = SourcePosition(offset); |
14273 // Now find the closest statement position before the position. | 14287 // Now find the closest statement position before the position. |
14274 int statement_position = 0; | 14288 int statement_position = 0; |
14275 for (SourcePositionTableIterator it(source_position_table()); !it.done(); | 14289 for (SourcePositionTableIterator it(source_position_table()); !it.done(); |
14276 it.Advance()) { | 14290 it.Advance()) { |
14277 if (it.is_statement()) { | 14291 if (it.is_statement()) { |
14278 int p = it.source_position(); | 14292 int p = it.source_position().ScriptOffset(); |
14279 if (statement_position < p && p <= position) { | 14293 if (statement_position < p && p <= position) { |
14280 statement_position = p; | 14294 statement_position = p; |
14281 } | 14295 } |
14282 } | 14296 } |
14283 } | 14297 } |
14284 return statement_position; | 14298 return statement_position; |
14285 } | 14299 } |
14286 | 14300 |
14287 void JSFunction::ClearTypeFeedbackInfo() { | 14301 void JSFunction::ClearTypeFeedbackInfo() { |
14288 feedback_vector()->ClearSlots(shared()); | 14302 feedback_vector()->ClearSlots(shared()); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
14486 UNREACHABLE(); | 14500 UNREACHABLE(); |
14487 break; | 14501 break; |
14488 } | 14502 } |
14489 return NULL; | 14503 return NULL; |
14490 } | 14504 } |
14491 | 14505 |
14492 | 14506 |
14493 void Code::PrintDeoptLocation(FILE* out, Address pc) { | 14507 void Code::PrintDeoptLocation(FILE* out, Address pc) { |
14494 Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(this, pc); | 14508 Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(this, pc); |
14495 class SourcePosition pos = info.position; | 14509 class SourcePosition pos = info.position; |
14496 if (info.deopt_reason != DeoptimizeReason::kNoReason || !pos.IsUnknown()) { | 14510 if (info.deopt_reason != DeoptimizeReason::kNoReason || pos.IsKnown()) { |
14497 if (FLAG_hydrogen_track_positions) { | 14511 if (FLAG_hydrogen_track_positions) { |
14498 PrintF(out, " ;;; deoptimize at %d_%d: %s\n", | 14512 PrintF(out, " ;;; deoptimize at %d_%d: %s\n", pos.InliningId(), |
14499 pos.inlining_id(), pos.position(), | 14513 pos.ScriptOffset(), DeoptimizeReasonToString(info.deopt_reason)); |
14500 DeoptimizeReasonToString(info.deopt_reason)); | |
14501 } else { | 14514 } else { |
14502 PrintF(out, " ;;; deoptimize at %d: %s\n", pos.raw(), | 14515 PrintF(out, " ;;; deoptimize at "); |
14503 DeoptimizeReasonToString(info.deopt_reason)); | 14516 OFStream outstr(out); |
14517 pos.Print(outstr, this); | |
14518 PrintF(out, ", %s\n", DeoptimizeReasonToString(info.deopt_reason)); | |
14504 } | 14519 } |
14505 } | 14520 } |
14506 } | 14521 } |
14507 | 14522 |
14508 | 14523 |
14509 bool Code::CanDeoptAt(Address pc) { | 14524 bool Code::CanDeoptAt(Address pc) { |
14510 DeoptimizationInputData* deopt_data = | 14525 DeoptimizationInputData* deopt_data = |
14511 DeoptimizationInputData::cast(deoptimization_data()); | 14526 DeoptimizationInputData::cast(deoptimization_data()); |
14512 Address code_start_address = instruction_start(); | 14527 Address code_start_address = instruction_start(); |
14513 for (int i = 0; i < deopt_data->DeoptCount(); i++) { | 14528 for (int i = 0; i < deopt_data->DeoptCount(); i++) { |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
14932 } | 14947 } |
14933 } | 14948 } |
14934 } | 14949 } |
14935 os << "\n"; | 14950 os << "\n"; |
14936 | 14951 |
14937 SourcePositionTableIterator it(source_position_table()); | 14952 SourcePositionTableIterator it(source_position_table()); |
14938 if (!it.done()) { | 14953 if (!it.done()) { |
14939 os << "Source positions:\n pc offset position\n"; | 14954 os << "Source positions:\n pc offset position\n"; |
14940 for (; !it.done(); it.Advance()) { | 14955 for (; !it.done(); it.Advance()) { |
14941 os << std::setw(10) << it.code_offset() << std::setw(10) | 14956 os << std::setw(10) << it.code_offset() << std::setw(10) |
14942 << it.source_position() << (it.is_statement() ? " statement" : "") | 14957 << it.source_position().ScriptOffset() |
14943 << "\n"; | 14958 << (it.is_statement() ? " statement" : "") << "\n"; |
14944 } | 14959 } |
14945 os << "\n"; | 14960 os << "\n"; |
14946 } | 14961 } |
14947 | 14962 |
14948 if (kind() == FUNCTION) { | 14963 if (kind() == FUNCTION) { |
14949 DeoptimizationOutputData* data = | 14964 DeoptimizationOutputData* data = |
14950 DeoptimizationOutputData::cast(this->deoptimization_data()); | 14965 DeoptimizationOutputData::cast(this->deoptimization_data()); |
14951 data->DeoptimizationOutputDataPrint(os); | 14966 data->DeoptimizationOutputDataPrint(os); |
14952 } else if (kind() == OPTIMIZED_FUNCTION) { | 14967 } else if (kind() == OPTIMIZED_FUNCTION) { |
14953 DeoptimizationInputData* data = | 14968 DeoptimizationInputData* data = |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15035 os << "Parameter count " << parameter_count() << "\n"; | 15050 os << "Parameter count " << parameter_count() << "\n"; |
15036 os << "Frame size " << frame_size() << "\n"; | 15051 os << "Frame size " << frame_size() << "\n"; |
15037 | 15052 |
15038 const uint8_t* base_address = GetFirstBytecodeAddress(); | 15053 const uint8_t* base_address = GetFirstBytecodeAddress(); |
15039 SourcePositionTableIterator source_positions(source_position_table()); | 15054 SourcePositionTableIterator source_positions(source_position_table()); |
15040 | 15055 |
15041 interpreter::BytecodeArrayIterator iterator(handle(this)); | 15056 interpreter::BytecodeArrayIterator iterator(handle(this)); |
15042 while (!iterator.done()) { | 15057 while (!iterator.done()) { |
15043 if (!source_positions.done() && | 15058 if (!source_positions.done() && |
15044 iterator.current_offset() == source_positions.code_offset()) { | 15059 iterator.current_offset() == source_positions.code_offset()) { |
15045 os << std::setw(5) << source_positions.source_position(); | 15060 os << std::setw(5) << source_positions.source_position().ScriptOffset(); |
15046 os << (source_positions.is_statement() ? " S> " : " E> "); | 15061 os << (source_positions.is_statement() ? " S> " : " E> "); |
15047 source_positions.Advance(); | 15062 source_positions.Advance(); |
15048 } else { | 15063 } else { |
15049 os << " "; | 15064 os << " "; |
15050 } | 15065 } |
15051 const uint8_t* current_address = base_address + iterator.current_offset(); | 15066 const uint8_t* current_address = base_address + iterator.current_offset(); |
15052 os << reinterpret_cast<const void*>(current_address) << " @ " | 15067 os << reinterpret_cast<const void*>(current_address) << " @ " |
15053 << std::setw(4) << iterator.current_offset() << " : "; | 15068 << std::setw(4) << iterator.current_offset() << " : "; |
15054 interpreter::BytecodeDecoder::Decode(os, current_address, | 15069 interpreter::BytecodeDecoder::Decode(os, current_address, |
15055 parameter_count()); | 15070 parameter_count()); |
(...skipping 4312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
19368 | 19383 |
19369 } // namespace | 19384 } // namespace |
19370 | 19385 |
19371 int JSMessageObject::GetLineNumber() const { | 19386 int JSMessageObject::GetLineNumber() const { |
19372 if (start_position() == -1) return Message::kNoLineNumberInfo; | 19387 if (start_position() == -1) return Message::kNoLineNumberInfo; |
19373 | 19388 |
19374 Handle<Script> the_script = handle(ScriptFromJSValue(script())); | 19389 Handle<Script> the_script = handle(ScriptFromJSValue(script())); |
19375 | 19390 |
19376 Script::PositionInfo info; | 19391 Script::PositionInfo info; |
19377 const Script::OffsetFlag offset_flag = Script::WITH_OFFSET; | 19392 const Script::OffsetFlag offset_flag = Script::WITH_OFFSET; |
19378 if (!the_script->GetPositionInfo(start_position(), &info, offset_flag)) { | 19393 if (!Script::GetPositionInfo(the_script, start_position(), &info, |
19394 offset_flag)) { | |
19379 return Message::kNoLineNumberInfo; | 19395 return Message::kNoLineNumberInfo; |
19380 } | 19396 } |
19381 | 19397 |
19382 return info.line + 1; | 19398 return info.line + 1; |
19383 } | 19399 } |
19384 | 19400 |
19385 int JSMessageObject::GetColumnNumber() const { | 19401 int JSMessageObject::GetColumnNumber() const { |
19386 if (start_position() == -1) return -1; | 19402 if (start_position() == -1) return -1; |
19387 | 19403 |
19388 Handle<Script> the_script = handle(ScriptFromJSValue(script())); | 19404 Handle<Script> the_script = handle(ScriptFromJSValue(script())); |
19389 | 19405 |
19390 Script::PositionInfo info; | 19406 Script::PositionInfo info; |
19391 const Script::OffsetFlag offset_flag = Script::WITH_OFFSET; | 19407 const Script::OffsetFlag offset_flag = Script::WITH_OFFSET; |
19392 if (!the_script->GetPositionInfo(start_position(), &info, offset_flag)) { | 19408 if (!Script::GetPositionInfo(the_script, start_position(), &info, |
19409 offset_flag)) { | |
19393 return -1; | 19410 return -1; |
19394 } | 19411 } |
19395 | 19412 |
19396 return info.column; // Note: No '+1' in contrast to GetLineNumber. | 19413 return info.column; // Note: No '+1' in contrast to GetLineNumber. |
19397 } | 19414 } |
19398 | 19415 |
19399 Handle<String> JSMessageObject::GetSourceLine() const { | 19416 Handle<String> JSMessageObject::GetSourceLine() const { |
19400 Handle<Script> the_script = handle(ScriptFromJSValue(script())); | 19417 Handle<Script> the_script = handle(ScriptFromJSValue(script())); |
19401 | 19418 |
19402 Isolate* isolate = the_script->GetIsolate(); | 19419 Isolate* isolate = the_script->GetIsolate(); |
19403 if (the_script->type() == Script::TYPE_WASM) { | 19420 if (the_script->type() == Script::TYPE_WASM) { |
19404 return isolate->factory()->empty_string(); | 19421 return isolate->factory()->empty_string(); |
19405 } | 19422 } |
19406 | 19423 |
19407 Script::PositionInfo info; | 19424 Script::PositionInfo info; |
19408 const Script::OffsetFlag offset_flag = Script::WITH_OFFSET; | 19425 const Script::OffsetFlag offset_flag = Script::WITH_OFFSET; |
19409 if (!the_script->GetPositionInfo(start_position(), &info, offset_flag)) { | 19426 if (!Script::GetPositionInfo(the_script, start_position(), &info, |
19427 offset_flag)) { | |
19410 return isolate->factory()->empty_string(); | 19428 return isolate->factory()->empty_string(); |
19411 } | 19429 } |
19412 | 19430 |
19413 Handle<String> src = handle(String::cast(the_script->source()), isolate); | 19431 Handle<String> src = handle(String::cast(the_script->source()), isolate); |
19414 return isolate->factory()->NewSubString(src, info.line_start, info.line_end); | 19432 return isolate->factory()->NewSubString(src, info.line_start, info.line_end); |
19415 } | 19433 } |
19416 | 19434 |
19417 void JSArrayBuffer::Neuter() { | 19435 void JSArrayBuffer::Neuter() { |
19418 CHECK(is_neuterable()); | 19436 CHECK(is_neuterable()); |
19419 CHECK(is_external()); | 19437 CHECK(is_external()); |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
20262 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr)) | 20280 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr)) |
20263 .Check(); | 20281 .Check(); |
20264 } | 20282 } |
20265 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked(); | 20283 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked(); |
20266 | 20284 |
20267 return ns; | 20285 return ns; |
20268 } | 20286 } |
20269 | 20287 |
20270 } // namespace internal | 20288 } // namespace internal |
20271 } // namespace v8 | 20289 } // namespace v8 |
OLD | NEW |