Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Side by Side Diff: src/isolate.cc

Issue 352813002: Wrap InitializeProperty around SetOwnPropertyIgnoreAttributes and switch over uses (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/factory.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::SetOwnPropertyIgnoreAttributes( 497 JSObject::AddProperty(
498 stack_frame, column_key, 498 stack_frame, column_key,
499 Handle<Smi>(Smi::FromInt(column_offset + 1), this), NONE).Check(); 499 handle(Smi::FromInt(column_offset + 1), this), NONE);
500 } 500 }
501 JSObject::SetOwnPropertyIgnoreAttributes( 501 JSObject::AddProperty(
502 stack_frame, line_key, 502 stack_frame, line_key,
503 Handle<Smi>(Smi::FromInt(line_number + 1), this), NONE).Check(); 503 handle(Smi::FromInt(line_number + 1), this), NONE);
504 } 504 }
505 505
506 if (options & StackTrace::kScriptId) { 506 if (options & StackTrace::kScriptId) {
507 Handle<Smi> script_id(script->id(), this); 507 JSObject::AddProperty(
508 JSObject::SetOwnPropertyIgnoreAttributes( 508 stack_frame, script_id_key, handle(script->id(), this), NONE);
509 stack_frame, script_id_key, script_id, NONE).Check();
510 } 509 }
511 510
512 if (options & StackTrace::kScriptName) { 511 if (options & StackTrace::kScriptName) {
513 Handle<Object> script_name(script->name(), this); 512 JSObject::AddProperty(
514 JSObject::SetOwnPropertyIgnoreAttributes( 513 stack_frame, script_name_key, handle(script->name(), this), NONE);
515 stack_frame, script_name_key, script_name, NONE).Check();
516 } 514 }
517 515
518 if (options & StackTrace::kScriptNameOrSourceURL) { 516 if (options & StackTrace::kScriptNameOrSourceURL) {
519 Handle<Object> result = Script::GetNameOrSourceURL(script); 517 Handle<Object> result = Script::GetNameOrSourceURL(script);
520 JSObject::SetOwnPropertyIgnoreAttributes( 518 JSObject::AddProperty(
521 stack_frame, script_name_or_source_url_key, result, NONE).Check(); 519 stack_frame, script_name_or_source_url_key, result, NONE);
522 } 520 }
523 521
524 if (options & StackTrace::kFunctionName) { 522 if (options & StackTrace::kFunctionName) {
525 Handle<Object> fun_name(fun->shared()->name(), this); 523 Handle<Object> fun_name(fun->shared()->name(), this);
526 if (!fun_name->BooleanValue()) { 524 if (!fun_name->BooleanValue()) {
527 fun_name = Handle<Object>(fun->shared()->inferred_name(), this); 525 fun_name = Handle<Object>(fun->shared()->inferred_name(), this);
528 } 526 }
529 JSObject::SetOwnPropertyIgnoreAttributes( 527 JSObject::AddProperty(stack_frame, function_key, fun_name, NONE);
530 stack_frame, function_key, fun_name, NONE).Check();
531 } 528 }
532 529
533 if (options & StackTrace::kIsEval) { 530 if (options & StackTrace::kIsEval) {
534 Handle<Object> is_eval = 531 Handle<Object> is_eval =
535 script->compilation_type() == Script::COMPILATION_TYPE_EVAL ? 532 script->compilation_type() == Script::COMPILATION_TYPE_EVAL ?
536 factory()->true_value() : factory()->false_value(); 533 factory()->true_value() : factory()->false_value();
537 JSObject::SetOwnPropertyIgnoreAttributes( 534 JSObject::AddProperty(stack_frame, eval_key, is_eval, NONE);
538 stack_frame, eval_key, is_eval, NONE).Check();
539 } 535 }
540 536
541 if (options & StackTrace::kIsConstructor) { 537 if (options & StackTrace::kIsConstructor) {
542 Handle<Object> is_constructor = (frames[i].is_constructor()) ? 538 Handle<Object> is_constructor = (frames[i].is_constructor()) ?
543 factory()->true_value() : factory()->false_value(); 539 factory()->true_value() : factory()->false_value();
544 JSObject::SetOwnPropertyIgnoreAttributes( 540 JSObject::AddProperty(
545 stack_frame, constructor_key, is_constructor, NONE).Check(); 541 stack_frame, constructor_key, is_constructor, NONE);
546 } 542 }
547 543
548 FixedArray::cast(stack_trace->elements())->set(frames_seen, *stack_frame); 544 FixedArray::cast(stack_trace->elements())->set(frames_seen, *stack_frame);
549 frames_seen++; 545 frames_seen++;
550 } 546 }
551 it.Advance(); 547 it.Advance();
552 } 548 }
553 549
554 stack_trace->set_length(Smi::FromInt(frames_seen)); 550 stack_trace->set_length(Smi::FromInt(frames_seen));
555 return stack_trace; 551 return stack_trace;
(...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 // The simulator uses a separate JS stack. 2361 // The simulator uses a separate JS stack.
2366 Address jssp_address = Simulator::current(isolate_)->get_sp(); 2362 Address jssp_address = Simulator::current(isolate_)->get_sp();
2367 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); 2363 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address);
2368 if (jssp < stack_guard->real_jslimit()) return true; 2364 if (jssp < stack_guard->real_jslimit()) return true;
2369 #endif // USE_SIMULATOR 2365 #endif // USE_SIMULATOR
2370 return reinterpret_cast<uintptr_t>(this) < stack_guard->real_climit(); 2366 return reinterpret_cast<uintptr_t>(this) < stack_guard->real_climit();
2371 } 2367 }
2372 2368
2373 2369
2374 } } // namespace v8::internal 2370 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698