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

Side by Side Diff: src/accessors.cc

Issue 1130783002: Migrate error messages, part 9. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/factory.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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/contexts.h" 9 #include "src/contexts.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder())); 1437 JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder()));
1438 Context* context = Context::cast(instance->context()); 1438 Context* context = Context::cast(instance->context());
1439 DCHECK(context->IsModuleContext()); 1439 DCHECK(context->IsModuleContext());
1440 int slot = info.Data()->Int32Value(); 1440 int slot = info.Data()->Int32Value();
1441 Object* value = context->get(slot); 1441 Object* value = context->get(slot);
1442 Isolate* isolate = instance->GetIsolate(); 1442 Isolate* isolate = instance->GetIsolate();
1443 if (value->IsTheHole()) { 1443 if (value->IsTheHole()) {
1444 Handle<String> name = v8::Utils::OpenHandle(*property); 1444 Handle<String> name = v8::Utils::OpenHandle(*property);
1445 1445
1446 Handle<Object> exception = isolate->factory()->NewReferenceError( 1446 Handle<Object> exception = isolate->factory()->NewReferenceError(
1447 "not_defined", HandleVector(&name, 1)); 1447 MessageTemplate::kNotDefined, name);
1448 isolate->ScheduleThrow(*exception); 1448 isolate->ScheduleThrow(*exception);
1449 return; 1449 return;
1450 } 1450 }
1451 info.GetReturnValue().Set(v8::Utils::ToLocal(Handle<Object>(value, isolate))); 1451 info.GetReturnValue().Set(v8::Utils::ToLocal(Handle<Object>(value, isolate)));
1452 } 1452 }
1453 1453
1454 1454
1455 static void ModuleSetExport( 1455 static void ModuleSetExport(
1456 v8::Local<v8::String> property, 1456 v8::Local<v8::String> property,
1457 v8::Local<v8::Value> value, 1457 v8::Local<v8::Value> value,
1458 const v8::PropertyCallbackInfo<v8::Value>& info) { 1458 const v8::PropertyCallbackInfo<v8::Value>& info) {
1459 JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder())); 1459 JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder()));
1460 Context* context = Context::cast(instance->context()); 1460 Context* context = Context::cast(instance->context());
1461 DCHECK(context->IsModuleContext()); 1461 DCHECK(context->IsModuleContext());
1462 int slot = info.Data()->Int32Value(); 1462 int slot = info.Data()->Int32Value();
1463 Object* old_value = context->get(slot); 1463 Object* old_value = context->get(slot);
1464 Isolate* isolate = context->GetIsolate(); 1464 Isolate* isolate = context->GetIsolate();
1465 if (old_value->IsTheHole()) { 1465 if (old_value->IsTheHole()) {
1466 Handle<String> name = v8::Utils::OpenHandle(*property); 1466 Handle<String> name = v8::Utils::OpenHandle(*property);
1467 Handle<Object> exception = isolate->factory()->NewReferenceError( 1467 Handle<Object> exception = isolate->factory()->NewReferenceError(
1468 "not_defined", HandleVector(&name, 1)); 1468 MessageTemplate::kNotDefined, name);
1469 isolate->ScheduleThrow(*exception); 1469 isolate->ScheduleThrow(*exception);
1470 return; 1470 return;
1471 } 1471 }
1472 context->set(slot, *v8::Utils::OpenHandle(*value)); 1472 context->set(slot, *v8::Utils::OpenHandle(*value));
1473 } 1473 }
1474 1474
1475 1475
1476 Handle<AccessorInfo> Accessors::MakeModuleExport( 1476 Handle<AccessorInfo> Accessors::MakeModuleExport(
1477 Handle<String> name, 1477 Handle<String> name,
1478 int index, 1478 int index,
1479 PropertyAttributes attributes) { 1479 PropertyAttributes attributes) {
1480 Isolate* isolate = name->GetIsolate(); 1480 Isolate* isolate = name->GetIsolate();
1481 Factory* factory = isolate->factory(); 1481 Factory* factory = isolate->factory();
1482 Handle<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo(); 1482 Handle<ExecutableAccessorInfo> info = factory->NewExecutableAccessorInfo();
1483 info->set_property_attributes(attributes); 1483 info->set_property_attributes(attributes);
1484 info->set_all_can_read(true); 1484 info->set_all_can_read(true);
1485 info->set_all_can_write(true); 1485 info->set_all_can_write(true);
1486 info->set_name(*name); 1486 info->set_name(*name);
1487 info->set_data(Smi::FromInt(index)); 1487 info->set_data(Smi::FromInt(index));
1488 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 1488 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
1489 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 1489 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
1490 info->set_getter(*getter); 1490 info->set_getter(*getter);
1491 if (!(attributes & ReadOnly)) info->set_setter(*setter); 1491 if (!(attributes & ReadOnly)) info->set_setter(*setter);
1492 return info; 1492 return info;
1493 } 1493 }
1494 1494
1495 1495
1496 } } // namespace v8::internal 1496 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698