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 // | |
475 // Accessors::ScriptSourceUrl | 441 // Accessors::ScriptSourceUrl |
476 // | 442 // |
477 | 443 |
478 | 444 |
479 void Accessors::ScriptSourceUrlGetter( | 445 void Accessors::ScriptSourceUrlGetter( |
480 v8::Local<v8::Name> name, | 446 v8::Local<v8::Name> name, |
481 const v8::PropertyCallbackInfo<v8::Value>& info) { | 447 const v8::PropertyCallbackInfo<v8::Value>& info) { |
482 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 448 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
483 DisallowHeapAllocation no_allocation; | 449 DisallowHeapAllocation no_allocation; |
484 HandleScope scope(isolate); | 450 HandleScope scope(isolate); |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 Isolate* isolate = name->GetIsolate(); | 1146 Isolate* isolate = name->GetIsolate(); |
1181 Handle<AccessorInfo> info = MakeAccessor(isolate, name, &ModuleGetExport, | 1147 Handle<AccessorInfo> info = MakeAccessor(isolate, name, &ModuleGetExport, |
1182 &ModuleSetExport, attributes); | 1148 &ModuleSetExport, attributes); |
1183 info->set_data(Smi::FromInt(index)); | 1149 info->set_data(Smi::FromInt(index)); |
1184 return info; | 1150 return info; |
1185 } | 1151 } |
1186 | 1152 |
1187 | 1153 |
1188 } // namespace internal | 1154 } // namespace internal |
1189 } // namespace v8 | 1155 } // namespace v8 |
OLD | NEW |