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 "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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 Handle<AccessorInfo> Accessors::ScriptCompilationTypeInfo( | 431 Handle<AccessorInfo> Accessors::ScriptCompilationTypeInfo( |
432 Isolate* isolate, PropertyAttributes attributes) { | 432 Isolate* isolate, PropertyAttributes attributes) { |
433 Handle<String> name(isolate->factory()->InternalizeOneByteString( | 433 Handle<String> name(isolate->factory()->InternalizeOneByteString( |
434 STATIC_CHAR_VECTOR("compilation_type"))); | 434 STATIC_CHAR_VECTOR("compilation_type"))); |
435 return MakeAccessor(isolate, name, &ScriptCompilationTypeGetter, nullptr, | 435 return MakeAccessor(isolate, name, &ScriptCompilationTypeGetter, nullptr, |
436 attributes); | 436 attributes); |
437 } | 437 } |
438 | 438 |
439 | 439 |
440 // | 440 // |
| 441 // Accessors::ScriptGetLineEnds |
| 442 // |
| 443 |
| 444 |
| 445 void Accessors::ScriptLineEndsGetter( |
| 446 v8::Local<v8::Name> name, |
| 447 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 448 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
| 449 HandleScope scope(isolate); |
| 450 Handle<Object> object = Utils::OpenHandle(*info.Holder()); |
| 451 Handle<Script> script( |
| 452 Script::cast(Handle<JSValue>::cast(object)->value()), isolate); |
| 453 Script::InitLineEnds(script); |
| 454 DCHECK(script->line_ends()->IsFixedArray()); |
| 455 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); |
| 456 // We do not want anyone to modify this array from JS. |
| 457 DCHECK(*line_ends == isolate->heap()->empty_fixed_array() || |
| 458 line_ends->map() == isolate->heap()->fixed_cow_array_map()); |
| 459 Handle<JSArray> js_array = |
| 460 isolate->factory()->NewJSArrayWithElements(line_ends); |
| 461 info.GetReturnValue().Set(Utils::ToLocal(js_array)); |
| 462 } |
| 463 |
| 464 |
| 465 Handle<AccessorInfo> Accessors::ScriptLineEndsInfo( |
| 466 Isolate* isolate, PropertyAttributes attributes) { |
| 467 Handle<String> name(isolate->factory()->InternalizeOneByteString( |
| 468 STATIC_CHAR_VECTOR("line_ends"))); |
| 469 return MakeAccessor(isolate, name, &ScriptLineEndsGetter, nullptr, |
| 470 attributes); |
| 471 } |
| 472 |
| 473 |
| 474 // |
441 // Accessors::ScriptSourceUrl | 475 // Accessors::ScriptSourceUrl |
442 // | 476 // |
443 | 477 |
444 | 478 |
445 void Accessors::ScriptSourceUrlGetter( | 479 void Accessors::ScriptSourceUrlGetter( |
446 v8::Local<v8::Name> name, | 480 v8::Local<v8::Name> name, |
447 const v8::PropertyCallbackInfo<v8::Value>& info) { | 481 const v8::PropertyCallbackInfo<v8::Value>& info) { |
448 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 482 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
449 DisallowHeapAllocation no_allocation; | 483 DisallowHeapAllocation no_allocation; |
450 HandleScope scope(isolate); | 484 HandleScope scope(isolate); |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 Isolate* isolate = name->GetIsolate(); | 1180 Isolate* isolate = name->GetIsolate(); |
1147 Handle<AccessorInfo> info = MakeAccessor(isolate, name, &ModuleGetExport, | 1181 Handle<AccessorInfo> info = MakeAccessor(isolate, name, &ModuleGetExport, |
1148 &ModuleSetExport, attributes); | 1182 &ModuleSetExport, attributes); |
1149 info->set_data(Smi::FromInt(index)); | 1183 info->set_data(Smi::FromInt(index)); |
1150 return info; | 1184 return info; |
1151 } | 1185 } |
1152 | 1186 |
1153 | 1187 |
1154 } // namespace internal | 1188 } // namespace internal |
1155 } // namespace v8 | 1189 } // namespace v8 |
OLD | NEW |