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

Side by Side Diff: src/isolate.cc

Issue 225283005: Return MaybeHandle from SetProperty. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 years, 8 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/isolate.h ('k') | src/json-parser.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 // 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 if (options & StackTrace::kColumnOffset && relative_line_number >= 0) { 566 if (options & StackTrace::kColumnOffset && relative_line_number >= 0) {
567 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); 567 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends()));
568 int start = (relative_line_number == 0) ? 0 : 568 int start = (relative_line_number == 0) ? 0 :
569 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1; 569 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1;
570 int column_offset = position - start; 570 int column_offset = position - start;
571 if (relative_line_number == 0) { 571 if (relative_line_number == 0) {
572 // For the case where the code is on the same line as the script 572 // For the case where the code is on the same line as the script
573 // tag. 573 // tag.
574 column_offset += script->column_offset()->value(); 574 column_offset += script->column_offset()->value();
575 } 575 }
576 CHECK_NOT_EMPTY_HANDLE( 576 JSObject::SetLocalPropertyIgnoreAttributes(
577 this, 577 stack_frame, column_key,
578 JSObject::SetLocalPropertyIgnoreAttributes( 578 Handle<Smi>(Smi::FromInt(column_offset + 1), this), NONE).Check();
579 stack_frame, column_key,
580 Handle<Smi>(Smi::FromInt(column_offset + 1), this), NONE));
581 } 579 }
582 CHECK_NOT_EMPTY_HANDLE( 580 JSObject::SetLocalPropertyIgnoreAttributes(
583 this, 581 stack_frame, line_key,
584 JSObject::SetLocalPropertyIgnoreAttributes( 582 Handle<Smi>(Smi::FromInt(line_number + 1), this), NONE).Check();
585 stack_frame, line_key,
586 Handle<Smi>(Smi::FromInt(line_number + 1), this), NONE));
587 } 583 }
588 584
589 if (options & StackTrace::kScriptId) { 585 if (options & StackTrace::kScriptId) {
590 Handle<Smi> script_id(script->id(), this); 586 Handle<Smi> script_id(script->id(), this);
591 CHECK_NOT_EMPTY_HANDLE(this, 587 JSObject::SetLocalPropertyIgnoreAttributes(
592 JSObject::SetLocalPropertyIgnoreAttributes( 588 stack_frame, script_id_key, script_id, NONE).Check();
593 stack_frame, script_id_key, script_id,
594 NONE));
595 } 589 }
596 590
597 if (options & StackTrace::kScriptName) { 591 if (options & StackTrace::kScriptName) {
598 Handle<Object> script_name(script->name(), this); 592 Handle<Object> script_name(script->name(), this);
599 CHECK_NOT_EMPTY_HANDLE(this, 593 JSObject::SetLocalPropertyIgnoreAttributes(
600 JSObject::SetLocalPropertyIgnoreAttributes( 594 stack_frame, script_name_key, script_name, NONE).Check();
601 stack_frame, script_name_key, script_name,
602 NONE));
603 } 595 }
604 596
605 if (options & StackTrace::kScriptNameOrSourceURL) { 597 if (options & StackTrace::kScriptNameOrSourceURL) {
606 Handle<Object> result = GetScriptNameOrSourceURL(script); 598 Handle<Object> result = GetScriptNameOrSourceURL(script);
607 CHECK_NOT_EMPTY_HANDLE(this, 599 JSObject::SetLocalPropertyIgnoreAttributes(
608 JSObject::SetLocalPropertyIgnoreAttributes( 600 stack_frame, script_name_or_source_url_key, result, NONE).Check();
609 stack_frame, script_name_or_source_url_key,
610 result, NONE));
611 } 601 }
612 602
613 if (options & StackTrace::kFunctionName) { 603 if (options & StackTrace::kFunctionName) {
614 Handle<Object> fun_name(fun->shared()->name(), this); 604 Handle<Object> fun_name(fun->shared()->name(), this);
615 if (!fun_name->BooleanValue()) { 605 if (!fun_name->BooleanValue()) {
616 fun_name = Handle<Object>(fun->shared()->inferred_name(), this); 606 fun_name = Handle<Object>(fun->shared()->inferred_name(), this);
617 } 607 }
618 CHECK_NOT_EMPTY_HANDLE(this, 608 JSObject::SetLocalPropertyIgnoreAttributes(
619 JSObject::SetLocalPropertyIgnoreAttributes( 609 stack_frame, function_key, fun_name, NONE).Check();
620 stack_frame, function_key, fun_name, NONE));
621 } 610 }
622 611
623 if (options & StackTrace::kIsEval) { 612 if (options & StackTrace::kIsEval) {
624 Handle<Object> is_eval = 613 Handle<Object> is_eval =
625 script->compilation_type() == Script::COMPILATION_TYPE_EVAL ? 614 script->compilation_type() == Script::COMPILATION_TYPE_EVAL ?
626 factory()->true_value() : factory()->false_value(); 615 factory()->true_value() : factory()->false_value();
627 CHECK_NOT_EMPTY_HANDLE(this, 616 JSObject::SetLocalPropertyIgnoreAttributes(
628 JSObject::SetLocalPropertyIgnoreAttributes( 617 stack_frame, eval_key, is_eval, NONE).Check();
629 stack_frame, eval_key, is_eval, NONE));
630 } 618 }
631 619
632 if (options & StackTrace::kIsConstructor) { 620 if (options & StackTrace::kIsConstructor) {
633 Handle<Object> is_constructor = (frames[i].is_constructor()) ? 621 Handle<Object> is_constructor = (frames[i].is_constructor()) ?
634 factory()->true_value() : factory()->false_value(); 622 factory()->true_value() : factory()->false_value();
635 CHECK_NOT_EMPTY_HANDLE(this, 623 JSObject::SetLocalPropertyIgnoreAttributes(
636 JSObject::SetLocalPropertyIgnoreAttributes( 624 stack_frame, constructor_key, is_constructor, NONE).Check();
637 stack_frame, constructor_key,
638 is_constructor, NONE));
639 } 625 }
640 626
641 FixedArray::cast(stack_trace->elements())->set(frames_seen, *stack_frame); 627 FixedArray::cast(stack_trace->elements())->set(frames_seen, *stack_frame);
642 frames_seen++; 628 frames_seen++;
643 } 629 }
644 it.Advance(); 630 it.Advance();
645 } 631 }
646 632
647 stack_trace->set_length(Smi::FromInt(frames_seen)); 633 stack_trace->set_length(Smi::FromInt(frames_seen));
648 return stack_trace; 634 return stack_trace;
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after
2303 Handle<JSObject> registry = factory()->NewJSObjectFromMap(map); 2289 Handle<JSObject> registry = factory()->NewJSObjectFromMap(map);
2304 heap()->set_symbol_registry(*registry); 2290 heap()->set_symbol_registry(*registry);
2305 2291
2306 static const char* nested[] = { 2292 static const char* nested[] = {
2307 "for", "for_api", "for_intern", "keyFor", "private_api", "private_intern" 2293 "for", "for_api", "for_intern", "keyFor", "private_api", "private_intern"
2308 }; 2294 };
2309 for (unsigned i = 0; i < ARRAY_SIZE(nested); ++i) { 2295 for (unsigned i = 0; i < ARRAY_SIZE(nested); ++i) {
2310 Handle<String> name = factory()->InternalizeUtf8String(nested[i]); 2296 Handle<String> name = factory()->InternalizeUtf8String(nested[i]);
2311 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map); 2297 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map);
2312 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8); 2298 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8);
2313 JSObject::SetProperty(registry, name, obj, NONE, STRICT); 2299 JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert();
2314 } 2300 }
2315 } 2301 }
2316 return Handle<JSObject>::cast(factory()->symbol_registry()); 2302 return Handle<JSObject>::cast(factory()->symbol_registry());
2317 } 2303 }
2318 2304
2319 2305
2320 } } // namespace v8::internal 2306 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/json-parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698