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

Side by Side Diff: src/accessors.cc

Issue 2028983002: Introduce IsUndefined(Isolate*) and IsTheHole(Isolate*) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase master Created 4 years, 6 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
« no previous file with comments | « no previous file | src/api.cc » ('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 "src/accessors.h" 5 #include "src/accessors.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/contexts.h" 8 #include "src/contexts.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/execution.h" 10 #include "src/execution.h"
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 564
565 void Accessors::ScriptEvalFromScriptGetter( 565 void Accessors::ScriptEvalFromScriptGetter(
566 v8::Local<v8::Name> name, 566 v8::Local<v8::Name> name,
567 const v8::PropertyCallbackInfo<v8::Value>& info) { 567 const v8::PropertyCallbackInfo<v8::Value>& info) {
568 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); 568 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
569 HandleScope scope(isolate); 569 HandleScope scope(isolate);
570 Handle<Object> object = Utils::OpenHandle(*info.Holder()); 570 Handle<Object> object = Utils::OpenHandle(*info.Holder());
571 Handle<Script> script( 571 Handle<Script> script(
572 Script::cast(Handle<JSValue>::cast(object)->value()), isolate); 572 Script::cast(Handle<JSValue>::cast(object)->value()), isolate);
573 Handle<Object> result = isolate->factory()->undefined_value(); 573 Handle<Object> result = isolate->factory()->undefined_value();
574 if (!script->eval_from_shared()->IsUndefined()) { 574 if (!script->eval_from_shared()->IsUndefined(isolate)) {
575 Handle<SharedFunctionInfo> eval_from_shared( 575 Handle<SharedFunctionInfo> eval_from_shared(
576 SharedFunctionInfo::cast(script->eval_from_shared())); 576 SharedFunctionInfo::cast(script->eval_from_shared()));
577 if (eval_from_shared->script()->IsScript()) { 577 if (eval_from_shared->script()->IsScript()) {
578 Handle<Script> eval_from_script(Script::cast(eval_from_shared->script())); 578 Handle<Script> eval_from_script(Script::cast(eval_from_shared->script()));
579 result = Script::GetWrapper(eval_from_script); 579 result = Script::GetWrapper(eval_from_script);
580 } 580 }
581 } 581 }
582 582
583 info.GetReturnValue().Set(Utils::ToLocal(result)); 583 info.GetReturnValue().Set(Utils::ToLocal(result));
584 } 584 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 630
631 void Accessors::ScriptEvalFromFunctionNameGetter( 631 void Accessors::ScriptEvalFromFunctionNameGetter(
632 v8::Local<v8::Name> name, 632 v8::Local<v8::Name> name,
633 const v8::PropertyCallbackInfo<v8::Value>& info) { 633 const v8::PropertyCallbackInfo<v8::Value>& info) {
634 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); 634 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
635 HandleScope scope(isolate); 635 HandleScope scope(isolate);
636 Handle<Object> object = Utils::OpenHandle(*info.Holder()); 636 Handle<Object> object = Utils::OpenHandle(*info.Holder());
637 Handle<Script> script( 637 Handle<Script> script(
638 Script::cast(Handle<JSValue>::cast(object)->value()), isolate); 638 Script::cast(Handle<JSValue>::cast(object)->value()), isolate);
639 Handle<Object> result = isolate->factory()->undefined_value(); 639 Handle<Object> result = isolate->factory()->undefined_value();
640 if (!script->eval_from_shared()->IsUndefined()) { 640 if (!script->eval_from_shared()->IsUndefined(isolate)) {
641 Handle<SharedFunctionInfo> shared( 641 Handle<SharedFunctionInfo> shared(
642 SharedFunctionInfo::cast(script->eval_from_shared())); 642 SharedFunctionInfo::cast(script->eval_from_shared()));
643 // Find the name of the function calling eval. 643 // Find the name of the function calling eval.
644 if (!shared->name()->IsUndefined()) { 644 if (!shared->name()->IsUndefined(isolate)) {
645 result = Handle<Object>(shared->name(), isolate); 645 result = Handle<Object>(shared->name(), isolate);
646 } else { 646 } else {
647 result = Handle<Object>(shared->inferred_name(), isolate); 647 result = Handle<Object>(shared->inferred_name(), isolate);
648 } 648 }
649 } 649 }
650 info.GetReturnValue().Set(Utils::ToLocal(result)); 650 info.GetReturnValue().Set(Utils::ToLocal(result));
651 } 651 }
652 652
653 653
654 Handle<AccessorInfo> Accessors::ScriptEvalFromFunctionNameInfo( 654 Handle<AccessorInfo> Accessors::ScriptEvalFromFunctionNameInfo(
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 .FromMaybe(-1); 1125 .FromMaybe(-1);
1126 if (slot < 0 || slot >= context->length()) { 1126 if (slot < 0 || slot >= context->length()) {
1127 Handle<Name> name = v8::Utils::OpenHandle(*property); 1127 Handle<Name> name = v8::Utils::OpenHandle(*property);
1128 1128
1129 Handle<Object> exception = isolate->factory()->NewReferenceError( 1129 Handle<Object> exception = isolate->factory()->NewReferenceError(
1130 MessageTemplate::kNotDefined, name); 1130 MessageTemplate::kNotDefined, name);
1131 isolate->ScheduleThrow(*exception); 1131 isolate->ScheduleThrow(*exception);
1132 return; 1132 return;
1133 } 1133 }
1134 Object* value = context->get(slot); 1134 Object* value = context->get(slot);
1135 if (value->IsTheHole()) { 1135 if (value->IsTheHole(isolate)) {
1136 Handle<Name> name = v8::Utils::OpenHandle(*property); 1136 Handle<Name> name = v8::Utils::OpenHandle(*property);
1137 1137
1138 Handle<Object> exception = isolate->factory()->NewReferenceError( 1138 Handle<Object> exception = isolate->factory()->NewReferenceError(
1139 MessageTemplate::kNotDefined, name); 1139 MessageTemplate::kNotDefined, name);
1140 isolate->ScheduleThrow(*exception); 1140 isolate->ScheduleThrow(*exception);
1141 return; 1141 return;
1142 } 1142 }
1143 info.GetReturnValue().Set(v8::Utils::ToLocal(Handle<Object>(value, isolate))); 1143 info.GetReturnValue().Set(v8::Utils::ToLocal(Handle<Object>(value, isolate)));
1144 } 1144 }
1145 1145
(...skipping 17 matching lines...) Expand all
1163 Isolate* isolate = name->GetIsolate(); 1163 Isolate* isolate = name->GetIsolate();
1164 Handle<AccessorInfo> info = MakeAccessor(isolate, name, &ModuleGetExport, 1164 Handle<AccessorInfo> info = MakeAccessor(isolate, name, &ModuleGetExport,
1165 &ModuleSetExport, attributes); 1165 &ModuleSetExport, attributes);
1166 info->set_data(Smi::FromInt(index)); 1166 info->set_data(Smi::FromInt(index));
1167 return info; 1167 return info;
1168 } 1168 }
1169 1169
1170 1170
1171 } // namespace internal 1171 } // namespace internal
1172 } // namespace v8 1172 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698