Lines Matching defs:context

256 bool WebSnapshotSerializer::TakeSnapshot(v8::Local<v8::Context> context,
269 exports->Get(v8_isolate, i)->ToString(context).ToLocalChecked();
276 auto script = ScriptCompiler::Compile(context, &source).ToLocalChecked();
277 v8::MaybeLocal<v8::Value> script_result = script->Run(context);
280 !script_result.ToLocalChecked()->ToObject(context).ToLocal(
293 exports->Get(v8_isolate, i)->ToString(context).ToLocalChecked();
328 Handle<Context> context =
330 SerializeContext(context);
362 // - For each context:
363 // - Serialized context
587 Context context = function->context();
588 if (context.IsNativeContext() || context.IsScriptContext()) {
591 DCHECK(context.IsFunctionContext() || context.IsBlockContext());
592 uint32_t context_id = GetContextId(context);
765 Handle<Context> context(function->context(), isolate_);
766 if (context->IsFunctionContext() || context->IsBlockContext()) {
767 DiscoverContext(context);
783 void WebSnapshotSerializer::DiscoverContext(Handle<Context> context) {
785 if (InsertIntoIndexMap(context_ids_, *context, id)) return;
788 contexts_ = ArrayList::Add(isolate_, contexts_, context);
790 Handle<ScopeInfo> scope_info = handle(context->scope_info(), isolate_);
798 Object value = context->get(scope_info->ContextHeaderLength() + i);
803 if (!context->previous().IsNativeContext() &&
804 !context->previous().IsScriptContext()) {
805 DiscoverContext(handle(context->previous(), isolate_));
891 // - 0 if there's no context, 1 + context id otherwise
906 // - 1 + context id
919 // Format (serialized context):
920 // - 0 if there's no parent context, 1 + parent context id otherwise
925 void WebSnapshotSerializer::SerializeContext(Handle<Context> context) {
927 if (!context->previous().IsNativeContext() &&
928 !context->previous().IsScriptContext()) {
929 parent_context_id = GetContextId(context->previous()) + 1;
932 // TODO(v8:11525): Use less space for encoding the context type.
933 if (context->IsFunctionContext()) {
935 } else if (context->IsBlockContext()) {
938 Throw("Unsupported context type");
944 Handle<ScopeInfo> scope_info(context->scope_info(), isolate_);
953 Handle<Object> value(context->get(scope_info->ContextHeaderLength() + i),
1196 uint32_t WebSnapshotSerializer::GetContextId(Context context) {
1198 bool return_value = context_ids_.Lookup(context, &id);
1600 Throw("Malformed context table");
1609 Throw("Malformed context type");
1614 // Parent context is serialized before child context. Note: not >= on
1618 Throw("Malformed context");
1624 Throw("Malformed context");
1638 parent_context = handle(isolate_->context(), isolate_);
1666 Handle<Context> context;
1669 context = factory()->NewFunctionContext(parent_context, scope_info);
1672 context = factory()->NewBlockContext(parent_context, scope_info);
1675 Throw("Unsupported context type");
1682 Object value = ReadValue(context, context_index);
1683 context->set(context_index, value);
1685 contexts_.set(i, *context);
1693 // TODO(v8:11525): Support (context-allocating) receiver.
1732 Throw("Unsupported context type");
1796 // Guards raw pointer "context" below.
1798 Context context = Context::cast(contexts_.get(context_id - 1));
1799 function->set_context(context);
1800 shared->set_outer_scope_info(context.scope_info());