OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "v8.h" | 7 #include "v8.h" |
8 | 8 |
9 #include "ast.h" | 9 #include "ast.h" |
10 #include "bootstrapper.h" | 10 #include "bootstrapper.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 if (options & StackTrace::kColumnOffset && relative_line_number >= 0) { | 487 if (options & StackTrace::kColumnOffset && relative_line_number >= 0) { |
488 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); | 488 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); |
489 int start = (relative_line_number == 0) ? 0 : | 489 int start = (relative_line_number == 0) ? 0 : |
490 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1; | 490 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1; |
491 int column_offset = position - start; | 491 int column_offset = position - start; |
492 if (relative_line_number == 0) { | 492 if (relative_line_number == 0) { |
493 // For the case where the code is on the same line as the script | 493 // For the case where the code is on the same line as the script |
494 // tag. | 494 // tag. |
495 column_offset += script->column_offset()->value(); | 495 column_offset += script->column_offset()->value(); |
496 } | 496 } |
497 JSObject::SetLocalPropertyIgnoreAttributes( | 497 JSObject::SetOwnPropertyIgnoreAttributes( |
498 stack_frame, column_key, | 498 stack_frame, column_key, |
499 Handle<Smi>(Smi::FromInt(column_offset + 1), this), NONE).Check(); | 499 Handle<Smi>(Smi::FromInt(column_offset + 1), this), NONE).Check(); |
500 } | 500 } |
501 JSObject::SetLocalPropertyIgnoreAttributes( | 501 JSObject::SetOwnPropertyIgnoreAttributes( |
502 stack_frame, line_key, | 502 stack_frame, line_key, |
503 Handle<Smi>(Smi::FromInt(line_number + 1), this), NONE).Check(); | 503 Handle<Smi>(Smi::FromInt(line_number + 1), this), NONE).Check(); |
504 } | 504 } |
505 | 505 |
506 if (options & StackTrace::kScriptId) { | 506 if (options & StackTrace::kScriptId) { |
507 Handle<Smi> script_id(script->id(), this); | 507 Handle<Smi> script_id(script->id(), this); |
508 JSObject::SetLocalPropertyIgnoreAttributes( | 508 JSObject::SetOwnPropertyIgnoreAttributes( |
509 stack_frame, script_id_key, script_id, NONE).Check(); | 509 stack_frame, script_id_key, script_id, NONE).Check(); |
510 } | 510 } |
511 | 511 |
512 if (options & StackTrace::kScriptName) { | 512 if (options & StackTrace::kScriptName) { |
513 Handle<Object> script_name(script->name(), this); | 513 Handle<Object> script_name(script->name(), this); |
514 JSObject::SetLocalPropertyIgnoreAttributes( | 514 JSObject::SetOwnPropertyIgnoreAttributes( |
515 stack_frame, script_name_key, script_name, NONE).Check(); | 515 stack_frame, script_name_key, script_name, NONE).Check(); |
516 } | 516 } |
517 | 517 |
518 if (options & StackTrace::kScriptNameOrSourceURL) { | 518 if (options & StackTrace::kScriptNameOrSourceURL) { |
519 Handle<Object> result = Script::GetNameOrSourceURL(script); | 519 Handle<Object> result = Script::GetNameOrSourceURL(script); |
520 JSObject::SetLocalPropertyIgnoreAttributes( | 520 JSObject::SetOwnPropertyIgnoreAttributes( |
521 stack_frame, script_name_or_source_url_key, result, NONE).Check(); | 521 stack_frame, script_name_or_source_url_key, result, NONE).Check(); |
522 } | 522 } |
523 | 523 |
524 if (options & StackTrace::kFunctionName) { | 524 if (options & StackTrace::kFunctionName) { |
525 Handle<Object> fun_name(fun->shared()->name(), this); | 525 Handle<Object> fun_name(fun->shared()->name(), this); |
526 if (!fun_name->BooleanValue()) { | 526 if (!fun_name->BooleanValue()) { |
527 fun_name = Handle<Object>(fun->shared()->inferred_name(), this); | 527 fun_name = Handle<Object>(fun->shared()->inferred_name(), this); |
528 } | 528 } |
529 JSObject::SetLocalPropertyIgnoreAttributes( | 529 JSObject::SetOwnPropertyIgnoreAttributes( |
530 stack_frame, function_key, fun_name, NONE).Check(); | 530 stack_frame, function_key, fun_name, NONE).Check(); |
531 } | 531 } |
532 | 532 |
533 if (options & StackTrace::kIsEval) { | 533 if (options & StackTrace::kIsEval) { |
534 Handle<Object> is_eval = | 534 Handle<Object> is_eval = |
535 script->compilation_type() == Script::COMPILATION_TYPE_EVAL ? | 535 script->compilation_type() == Script::COMPILATION_TYPE_EVAL ? |
536 factory()->true_value() : factory()->false_value(); | 536 factory()->true_value() : factory()->false_value(); |
537 JSObject::SetLocalPropertyIgnoreAttributes( | 537 JSObject::SetOwnPropertyIgnoreAttributes( |
538 stack_frame, eval_key, is_eval, NONE).Check(); | 538 stack_frame, eval_key, is_eval, NONE).Check(); |
539 } | 539 } |
540 | 540 |
541 if (options & StackTrace::kIsConstructor) { | 541 if (options & StackTrace::kIsConstructor) { |
542 Handle<Object> is_constructor = (frames[i].is_constructor()) ? | 542 Handle<Object> is_constructor = (frames[i].is_constructor()) ? |
543 factory()->true_value() : factory()->false_value(); | 543 factory()->true_value() : factory()->false_value(); |
544 JSObject::SetLocalPropertyIgnoreAttributes( | 544 JSObject::SetOwnPropertyIgnoreAttributes( |
545 stack_frame, constructor_key, is_constructor, NONE).Check(); | 545 stack_frame, constructor_key, is_constructor, NONE).Check(); |
546 } | 546 } |
547 | 547 |
548 FixedArray::cast(stack_trace->elements())->set(frames_seen, *stack_frame); | 548 FixedArray::cast(stack_trace->elements())->set(frames_seen, *stack_frame); |
549 frames_seen++; | 549 frames_seen++; |
550 } | 550 } |
551 it.Advance(); | 551 it.Advance(); |
552 } | 552 } |
553 | 553 |
554 stack_trace->set_length(Smi::FromInt(frames_seen)); | 554 stack_trace->set_length(Smi::FromInt(frames_seen)); |
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2285 Execution::Call(this, microtask, factory()->undefined_value(), | 2285 Execution::Call(this, microtask, factory()->undefined_value(), |
2286 0, NULL).Check(); | 2286 0, NULL).Check(); |
2287 } | 2287 } |
2288 } | 2288 } |
2289 | 2289 |
2290 handle_scope_implementer()->DecrementCallDepth(); | 2290 handle_scope_implementer()->DecrementCallDepth(); |
2291 } | 2291 } |
2292 | 2292 |
2293 | 2293 |
2294 } } // namespace v8::internal | 2294 } } // namespace v8::internal |
OLD | NEW |